/**
 * Webchat Kursus - Modern Elegant UI
 * Font: Inter
 * Design: Glassmorphism, Soft Shadow, Rounded 12px
 */

/* ==================== CSS Variables ==================== */
:root {
    /* Colors */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e2e8f0;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Border & Shadow */
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.3);
    
    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 70px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #475569;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --border-color: #334155;
    --glass-bg: rgba(30, 41, 59, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-base), color var(--transition-base);
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==================== Auth Pages ==================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 450px;
}

.auth-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-xl);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.auth-form label i {
    margin-right: 6px;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 600;
    transition: color var(--transition-fast);
}

.auth-footer a:hover {
    color: var(--primary-dark);
}

.auth-demo-info {
    margin-top: 25px;
    padding: 20px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.auth-demo-info h4 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.auth-demo-info ul {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-demo-info li {
    padding: 4px 0;
}

.auth-demo-info strong {
    color: var(--text-primary);
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.btn i {
    font-size: 1.1em;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #0891b2;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    font-size: 1.25rem;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ==================== Sidebar ==================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    transition: transform var(--transition-base);
    z-index: 1000;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 30px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.user-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger-color);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 15px 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* ==================== Main Content ==================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 30px;
    background: var(--bg-secondary);
}

.content-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.content-header h1 {
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-header p {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* ==================== Stats Cards ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
}

.stat-icon.bg-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-icon.bg-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-icon.bg-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
}

.stat-icon.bg-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ==================== Content Grid ==================== */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.content-section {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 25px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==================== Class Cards ==================== */
.class-list,
.classes-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.class-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 2px solid var(--border-color);
    transition: all var(--transition-fast);
}

.class-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.class-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.class-code {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.class-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.class-footer {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.class-mentor,
.class-members {
    display: flex;
    align-items: center;
    gap: 6px;
}

.class-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== Conversation List ==================== */
.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.conversations-container {
    max-width: 900px;
    margin: 0 auto;
}

.conversation-item,
.conversation-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    border: 2px solid transparent;
}

.conversation-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    padding: 20px;
}

.conversation-item:hover,
.conversation-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.conversation-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.conversation-header h3,
.conversation-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.conversation-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.conversation-message {
    color: var(--text-secondary);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.unread-badge {
    background: var(--danger-color);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.status-indicator.online {
    background: var(--success-color);
}

.status-indicator.offline {
    background: var(--text-muted);
}

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.95rem;
}

/* ==================== Toast Notification ==================== */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    transition: transform var(--transition-base);
    z-index: 9999;
    border-left: 4px solid var(--primary-color);
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-notification.success {
    border-left-color: var(--success-color);
}

.toast-notification.error {
    border-left-color: var(--danger-color);
}

.toast-notification i {
    font-size: 1.5rem;
}

.toast-notification.success i {
    color: var(--success-color);
}

.toast-notification.error i {
    color: var(--danger-color);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .content-header h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .conversation-avatar {
        width: 40px;
        height: 40px;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .stat-content h3 {
        font-size: 1.5rem;
    }
}

/* ==================== Chat Page ==================== */
.chat-page {
    padding: 0;
    display: flex;
    height: 100vh;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    height: 100vh;
}

.chat-header {
    padding: 20px 30px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.chat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.chat-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--bg-secondary);
}

.message {
    display: flex;
    gap: 12px;
    max-width: 70%;
}

.message-sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-received {
    align-self: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-sender {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    word-wrap: break-word;
}

.message-sent .message-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-received .message-bubble {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.message-bubble p {
    margin: 0;
    line-height: 1.5;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-sent .message-time {
    text-align: right;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.message-file i {
    font-size: 1.25rem;
}

.message-file a {
    color: inherit;
    text-decoration: underline;
    font-size: 0.9rem;
}

.message-link {
    color: #4dabf7;
    text-decoration: underline;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.message-link:hover {
    color: #74c0fc;
    text-decoration: none;
}

.message-sent .message-link {
    color: #e3f2fd;
}

.message-sent .message-link:hover {
    color: #ffffff;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 200px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.typing-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Chat Input */
.chat-input-container {
    padding: 20px 30px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.chat-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    resize: none;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-send {
    padding: 12px 20px;
    border-radius: var(--radius-md);
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-top: 10px;
    font-size: 0.9rem;
}

.btn-remove-file {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.btn-remove-file:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 30px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: var(--shadow-xl);
    z-index: 100;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    max-width: 320px;
}

.emoji-item {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    text-align: center;
}

.emoji-item:hover {
    background: var(--bg-hover);
    transform: scale(1.2);
}

/* Link URL Modal */
.link-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1002;
    align-items: center;
    justify-content: center;
}

.link-modal-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.link-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.link-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-modal-header h3 i {
    color: var(--primary-color);
}

.link-modal-body {
    padding: 20px;
}

.link-modal-body .form-group {
    margin-bottom: 20px;
}

.link-modal-body .form-group:last-child {
    margin-bottom: 0;
}

.link-modal-body label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.link-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* Members Sidebar */
.members-sidebar {
    position: fixed;
    right: -350px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    transition: right var(--transition-base);
    z-index: 1001;
}

.members-sidebar.active {
    right: 0;
}

.members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.members-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.member-avatar {
    width: 45px;
    height: 45px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.member-info {
    flex: 1;
}

.member-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.member-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==================== Profile Page ==================== */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.profile-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.profile-avatar-container {
    position: relative;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 4px solid var(--primary-color);
}

.avatar-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    border: 3px solid var(--bg-primary);
}

.profile-info h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-role {
    margin-bottom: 5px;
}

.profile-username {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.role-badge.role-admin {
    background: var(--danger-color);
    color: white;
}

.role-badge.role-mentor {
    background: var(--info-color);
    color: white;
}

.role-badge.role-siswa {
    background: var(--success-color);
    color: white;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.profile-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==================== Admin Panel ==================== */
.admin-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.action-card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 2px solid var(--border-color);
    transition: all var(--transition-fast);
}

.action-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.action-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    flex-shrink: 0;
}

.action-content {
    flex: 1;
}

.action-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.action-content p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.action-card i.bi-chevron-right {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Table */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-x: auto;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover {
    background: var(--bg-hover);
}

.table-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.offline {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

/* Members Grid */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.member-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 15px;
    transition: all var(--transition-fast);
}

.member-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.member-card .member-avatar {
    width: 80px;
    height: 80px;
}

.member-card .member-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.member-card .member-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
}

/* Form Container */
.form-container {
    max-width: 700px;
    margin: 0 auto;
}

.standard-form {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 30px;
    box-shadow: var(--shadow-sm);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== Responsive Chat ==================== */
@media (max-width: 768px) {
    .chat-page {
        flex-direction: column;
    }

    .chat-header {
        padding: 15px 20px;
    }

    .chat-messages {
        padding: 20px 15px;
    }

    .message {
        max-width: 85%;
    }

    .chat-input-container {
        padding: 15px 20px;
    }

    .emoji-picker {
        left: 20px;
        bottom: 70px;
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 240px;
    }

    .members-sidebar {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .chat-header h2 {
        font-size: 1.1rem;
    }

    .chat-avatar,
    .chat-icon {
        width: 40px;
        height: 40px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .members-grid,
    .classes-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== Enhanced Responsive Design ==================== */

/* Extra Small Devices (Phones, portrait, < 576px) */
@media (max-width: 575.98px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .stat-content h3 {
        font-size: 1.75rem;
    }
    
    .stat-content p {
        font-size: 0.875rem;
    }
    
    .content-header h1 {
        font-size: 1.5rem;
    }
    
    .auth-card {
        padding: 25px 15px;
    }
    
    .auth-icon {
        font-size: 2.5rem;
    }
    
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px 16px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .class-card {
        padding: 15px;
    }
    
    .conversation-avatar {
        width: 45px;
        height: 45px;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        min-width: 600px;
    }
    
    .modal-content {
        margin: 10px;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
}

/* Small Devices (Phones, landscape, 576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .classes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .members-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium Devices (Tablets, 768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .classes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chat-messages {
        padding: 25px 20px;
    }
    
    .message {
        max-width: 75%;
    }
}

/* Large Devices (Desktops, 992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .classes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra Large Devices (Large Desktops, >= 1200px) */
@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .classes-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .chat-messages {
        padding: 30px 40px;
    }
}

/* ==================== iOS Specific Fixes ==================== */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    input,
    textarea,
    select {
        font-size: 16px !important; /* Prevent zoom */
    }
    
    .chat-input {
        font-size: 16px !important;
    }
    
    /* Fix for iOS input shadow */
    input,
    textarea,
    select,
    .form-control {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Smooth scrolling for iOS */
    .chat-messages,
    .sidebar-nav,
    .conversation-list {
        -webkit-overflow-scrolling: touch;
    }
}

/* ==================== Android Specific Fixes ==================== */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    /* Android Chrome */
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 32px;
    }
}

/* ==================== Touch Device Enhancements ==================== */
@media (hover: none) and (pointer: coarse) {
    /* Touch devices */
    .btn,
    .nav-item,
    .btn-icon,
    .conversation-item,
    .class-card,
    .action-card {
        min-height: 44px; /* Apple's recommended touch target */
        min-width: 44px;
    }
    
    .btn-icon {
        padding: 12px;
        font-size: 1.5rem;
    }
    
    /* Remove hover effects on touch */
    .btn:hover,
    .nav-item:hover,
    .class-card:hover {
        transform: none;
    }
    
    /* Add active states instead */
    .btn:active,
    .nav-item:active,
    .class-card:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* ==================== Landscape Orientation ==================== */
@media (max-width: 767.98px) and (orientation: landscape) {
    .chat-header {
        padding: 10px 20px;
    }
    
    .chat-messages {
        padding: 15px 20px;
    }
    
    .auth-container {
        padding: 10px;
    }
    
    .auth-card {
        padding: 20px;
    }
    
    .sidebar {
        width: 260px;
    }
}

/* ==================== High DPI Screens ==================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Retina displays */
    .stat-icon,
    .chat-icon {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .sidebar,
    .chat-input-container,
    .btn,
    .toast-notification,
    .sidebar-overlay {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .chat-messages {
        background: white;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ==================== Accessibility Enhancements ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== Dark Mode Media Query ==================== */
@media (prefers-color-scheme: dark) {
    body:not(.dark-mode) {
        /* Optional: Auto dark mode if user prefers */
        /* Uncomment to enable auto dark mode based on system preference */
        /*
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --text-primary: #f1f5f9;
        */
    }
}

/* ==================== Safe Area (Notch Support) ==================== */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .sidebar {
        padding-left: max(20px, calc(20px + env(safe-area-inset-left)));
        padding-right: max(20px, calc(20px + env(safe-area-inset-right)));
    }
    
    .chat-input-container {
        padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
    }
    
    .toast-notification {
        top: max(20px, calc(20px + env(safe-area-inset-top)));
        right: max(20px, calc(20px + env(safe-area-inset-right)));
    }
}

/* ==================== Firefox Specific Fixes ==================== */
@-moz-document url-prefix() {
    .form-control,
    .chat-input {
        scrollbar-width: thin;
        scrollbar-color: var(--secondary-color) var(--bg-tertiary);
    }
}

/* ==================== Edge/IE Fallbacks ==================== */
@supports (-ms-ime-align: auto) {
    .stats-grid,
    .content-grid,
    .classes-grid {
        display: -ms-grid;
    }
}

/* ==================== Additional Mobile Optimizations ==================== */
@media (max-width: 767.98px) {
    /* Optimize spacing for mobile */
    .main-content {
        padding: 15px;
    }
    
    .content-header {
        margin-bottom: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-header .btn {
        width: 100%;
    }
    
    /* Mobile-friendly forms */
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Optimize admin tables for mobile */
    .action-buttons {
        flex-wrap: wrap;
    }
    
    /* Better touch targets */
    .emoji-item {
        padding: 12px;
        font-size: 1.75rem;
    }
    
    .emoji-grid {
        gap: 10px;
    }
}

/* ==================== Fold/Flip Phone Support ==================== */
@media (max-width: 380px) {
    .auth-card {
        padding: 20px 12px;
    }
    
    .chat-header h2 {
        font-size: 1rem;
    }
    
    .message-bubble {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        margin-bottom: 10px;
    }
}

/* ==================== Ultra-wide Screens ==================== */
@media (min-width: 1920px) {
    .main-content {
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
        padding-left: calc(var(--sidebar-width) + 40px);
    }
    
    .auth-container {
        max-width: 500px;
    }
    
    .chat-container {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* ==================== Auth Logo Style ==================== */
.auth-logo {
    display: block !important;
    max-width: 150px;
    max-height: 80px;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 0;
    margin-bottom: 15px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

/* ==================== Settings Page Responsive ==================== */
@media (max-width: 576px) {
    .settings-container {
        padding: 0;
    }
    
    .settings-body {
        padding: 20px 15px;
    }
    
    .settings-header {
        padding: 15px 20px;
    }
}
