/* ============================================
   NATO MESSENGER - GEN Z DARK MODE
   WhatsApp Style Interface
   ============================================ */

/* Manual keyboard padding override (optional) */
:root {
    --keyboard-extra-padding: 0px; /* Anda bisa ubah mis. 24px jika masih terpotong */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Gen Z Color Palette */
    --primary: #00d4ff;
    --primary-dark: #00a8cc;
    --secondary: #ff006e;
    --accent: #8338ec;
    --accent-light: #a855f7;
    
    /* Dark Theme */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-quaternary: #242424;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    
    /* Borders */
    --border: #2a2a2a;
    --border-light: #333333;
    
    /* Status Colors */
    --success: #00ff88;
    --warning: #ffbe0b;
    --error: #ff4757;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-accent: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-dark: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

* {
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(var(--vh, 1vh) * 100);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* ============================================
   AUTHENTICATION
   ============================================ */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(var(--vh, 1vh) * 100);
    background: var(--gradient-dark);
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(131, 56, 236, 0.1) 0%, transparent 50%);
    animation: float 30s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    50% { transform: translate(-50%, -50%) rotate(180deg); }
}

.auth-box {
    background: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo i {
    font-size: 56px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo h1 {
    font-size: 32px;
    font-weight: 800;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.logo .tagline {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

.form-section {
    display: none;
}

.form-section.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-section h2 {
    text-align: center;
    margin-bottom: 28px;
    color: var(--text-primary);
    font-size: 26px;
    font-weight: 700;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid var(--border);
    border-radius: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, 0.15);
    background: var(--bg-quaternary);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

.remember-me {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.remember-me label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    border-radius: 4px;
}

.remember-me input[type="checkbox"]:checked {
    background-color: var(--primary);
}

.remember-me span {
    color: var(--text-secondary);
    transition: color 0.3s;
}

.remember-me:hover span {
    color: var(--text-primary);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: var(--gradient-accent);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

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

/* ============================================
   MAIN APP
   ============================================ */

.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(var(--vh, 1vh) * 100);
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.chat-area[style*="display: none"] ~ .sidebar,
.chat-area.hidden ~ .sidebar {
    width: 100%;
}

.sidebar:only-child {
    width: 100%;
}

.hidden {
    display: none !important;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
    position: relative;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.profile-info img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

.profile-info h3 {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 2px;
}

.profile-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.menu-container {
    position: relative;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
    animation: dropdownSlide 0.2s ease-out;
    overflow: hidden;
}

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

.menu-dropdown button {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.menu-dropdown button:hover {
    background: var(--bg-quaternary);
}

.menu-dropdown button i {
    width: 20px;
    color: var(--text-secondary);
}

.menu-dropdown button:hover i {
    color: var(--primary);
}

.menu-dropdown button:last-child {
    color: var(--error);
}

.menu-dropdown button:last-child:hover {
    background: rgba(255, 71, 87, 0.1);
}

.search-container {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    position: relative;
    flex: 1;
}

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: none;
    border-radius: 24px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    background: var(--bg-quaternary);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.contact-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.contact-item:hover {
    background: var(--bg-tertiary);
}

.contact-item:hover::before,
.contact-item.active::before {
    transform: scaleY(1);
}

.contact-item.active {
    background: var(--bg-tertiary);
}

.contact-avatar {
    position: relative;
    width: 52px;
    height: 52px;
    margin-right: 14px;
    flex-shrink: 0;
}

.contact-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
    background: var(--border);
}

.status-indicator.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-last-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    margin-left: 12px;
}

.contact-time {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.unread-count {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.add-contact-btn {
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    font-size: 18px;
}

.add-contact-btn:hover {
    color: var(--primary);
    background: var(--bg-quaternary);
    transform: scale(1.05);
}

.add-contact-btn:active {
    transform: scale(0.95);
}

/* ============================================
   CHAT AREA
   ============================================ */

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    padding: 16px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}

.back-btn:hover {
    background: var(--bg-quaternary);
    transform: translateX(-2px);
    color: var(--text-primary);
}

.welcome-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.welcome-header i {
    font-size: 24px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-header h3 {
    font-size: 16px;
    font-weight: 500;
}

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

.chat-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-actions button:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
}

/* Dropdown Menu */
.dropdown-menu {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 180px;
    overflow: hidden;
    animation: dropdownSlide 0.2s ease-out;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-quaternary);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.dropdown-item.danger {
    color: var(--error);
}

.dropdown-item.danger:hover {
    background: rgba(255, 71, 87, 0.1);
    color: var(--error);
}

.dropdown-item.danger i {
    color: var(--error);
}

/* Contact Info Display */
.contact-info-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 20px 0;
}

.contact-info-display .profile-avatar-large {
    width: 120px;
    height: 120px;
}

.contact-info-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-info-details .info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.contact-info-details .info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.contact-info-details .info-item label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.contact-info-details .info-item span {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(131, 56, 236, 0.03) 0%, transparent 50%);
    background-color: var(--bg-primary);
}

.welcome-message {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.welcome-message i {
    font-size: 72px;
    margin-bottom: 24px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.welcome-message h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.welcome-message p {
    font-size: 15px;
    color: var(--text-secondary);
}

.message {
    margin-bottom: 12px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.sent {
    justify-content: flex-end;
}

.message.received {
    justify-content: flex-start;
}

.message-content {
    max-width: 65%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0; /* Allows flex child to shrink below content size */
}

.message.sent .message-content {
    align-items: flex-end;
}

.message.received .message-content {
    align-items: flex-start;
}

.message-text,
.message-file {
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap; /* Preserves whitespace but allows wrapping */
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden; /* Prevent overflow */
}

.message.sent .message-text,
.message.sent .message-file {
    background: var(--gradient-accent);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.message.received .message-text,
.message.received .message-file {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.message-image,
.message-video {
    max-width: 300px;
    max-height: 300px;
    border-radius: 12px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s;
}

.message-image:hover,
.message-video:hover {
    transform: scale(1.02);
}

.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
}

.file-icon {
    font-size: 24px;
    color: var(--primary);
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-info div:first-child {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-info small {
    font-size: 12px;
    color: var(--text-secondary);
}

.download-btn {
    color: var(--primary);
    font-size: 18px;
    text-decoration: none;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

.download-btn:hover {
    background: rgba(0, 212, 255, 0.1);
    transform: scale(1.1);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 0 4px;
}

.message-time {
    font-size: 11px;
    font-weight: 500;
}

.message-status {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-left: 4px;
}

.message-status.read {
    color: var(--success);
}

/* Message Edit/Delete */
.message-text.deleted {
    font-style: italic;
    opacity: 0.6;
    color: var(--text-secondary);
}

.edited-badge {
    font-size: 10px;
    color: var(--text-tertiary);
    font-style: italic;
    margin-left: 4px;
}

.message-context-menu {
    position: fixed;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    min-width: 150px;
    overflow: hidden;
    animation: menuSlide 0.2s ease-out;
}

@keyframes menuSlide {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.message-context-menu .menu-option {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.message-context-menu .menu-option:hover {
    background: var(--bg-quaternary);
}

.message-context-menu .menu-option.delete {
    color: var(--error);
}

.message-context-menu .menu-option.delete:hover {
    background: rgba(255, 71, 87, 0.1);
}

.message-context-menu .menu-option i {
    width: 18px;
    text-align: center;
}

.message-content.long-pressed {
    opacity: 0.8;
    transform: scale(0.98);
}

.message-edit-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    outline: none;
}

.edit-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.edit-save-btn,
.edit-cancel-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    font-size: 16px;
}

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

.edit-save-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.edit-cancel-btn {
    background: var(--bg-quaternary);
    color: var(--text-secondary);
}

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

.message-input-container {
    padding: 16px 24px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.message-input {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-quaternary);
    border-radius: 28px;
    padding: 8px 12px;
    border: 1px solid var(--border);
}

.attachment-btn,
.send-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attachment-btn:hover {
    color: var(--primary);
    background: var(--bg-tertiary);
}

.send-btn {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-input input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    padding: 4px 8px;
}

.message-input input:disabled {
    opacity: 0.5;
}

.message-input input::placeholder {
    color: var(--text-tertiary);
}

/* ============================================
   MODALS
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 24px;
    padding: 32px;
    width: 90%;
    max-width: 520px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-header h3 {
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
}

.close-btn {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.search-section {
    margin-bottom: 24px;
}

#searchUserResults {
    margin-top: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.search-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.search-user-item:hover {
    background: var(--bg-quaternary);
    border-color: var(--primary);
    transform: translateX(4px);
}

.search-user-info {
    flex: 1;
}

.search-user-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 15px;
}

.search-user-username {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 2px;
}

.search-user-id {
    color: var(--primary);
    font-size: 12px;
    font-weight: 500;
}

.search-user-item button {
    background: var(--gradient-accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
}

.search-user-item button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.attachment-modal {
    padding: 40px;
}

.attachment-options {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.attachment-options button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
    font-size: 14px;
    font-weight: 500;
}

.attachment-options button:hover {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.attachment-options i {
    font-size: 32px;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Profile Display */
.profile-display {
    text-align: center;
}

.profile-avatar-large {
    margin-bottom: 24px;
    position: relative;
    display: inline-block;
}

.profile-avatar-large img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.profile-info-display {
    text-align: left;
}

.info-item {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.info-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.info-item p {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

/* Avatar Upload */
.avatar-upload-section {
    text-align: center;
}

.avatar-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.avatar-preview img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-accent);
    border: 3px solid var(--bg-tertiary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.avatar-upload-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

.avatar-upload-section small {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 8px;
}

/* ============================================
   NOTIFICATIONS
   ============================================ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    background: var(--success);
}

.notification-error {
    background: var(--error);
}

.notification-warning {
    background: var(--warning);
}

.notification-info {
    background: var(--primary);
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
    transition: background 0.3s;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */

/* Mobile Devices (Portrait) */
@media (max-width: 480px) {
    .app-container {
        flex-direction: column;
        position: relative;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(0); /* Default visible on mobile */
        transition: transform 0.3s ease;
        background: var(--bg-secondary);
    }
    
    .sidebar.hidden-mobile {
        transform: translateX(-100%);
    }
    
    .chat-area {
        width: 100%;
        position: relative;
        z-index: 1;
    }
    
    .chat-area.hidden {
        display: none;
    }
    
    .message-content {
        max-width: 85%;
        min-width: 0;
    }
    
    .message-text,
    .message-file {
        font-size: 14px;
        padding: 10px 14px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: pre-wrap;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .message-image,
    .message-video {
        max-width: 250px;
        max-height: 250px;
    }
    
    .auth-box {
        margin: 16px;
        padding: 28px 20px;
        border-radius: 20px;
    }
    
    .logo h1 {
        font-size: 28px;
    }
    
    .logo i {
        font-size: 48px;
    }
    
    .modal-content {
        margin: 16px;
        padding: 20px;
        max-height: 85vh;
    }
    
    .profile-avatar-large img {
        width: 100px;
        height: 100px;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .message-input-container {
        padding: 12px 16px;
    }
    
    .contact-item {
        padding: 10px 16px;
    }
    
    .contact-avatar {
        width: 48px;
        height: 48px;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        height: 100vh;
        z-index: 100;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .sidebar-header {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .profile-info h3 {
        font-size: 14px;
    }
    
    .search-container {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .contacts-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
    
    .add-contact-btn {
        width: 40px;
        height: 40px;
        padding: 10px;
        font-size: 16px;
    }
    
    .messages-container {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 16px;
        /* Extra space for fixed input on mobile - cukup besar agar tidak tertutup keyboard */
        padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 350px);
        flex: 1;
        min-height: 0; /* Allows flex child to shrink */
    }
    
    .chat-area {
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        height: calc(var(--vh, 1vh) * 100);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0px);
    }
    
    .message-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 20;
        margin: 0;
        padding: 12px 16px;
        padding-bottom: 12px;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        background: var(--bg-tertiary);
        border-top: 1px solid var(--border);
        /* subtle elevation */
        box-shadow: 0 -8px 24px rgba(0,0,0,0.25);
        box-sizing: border-box;
    }
    
    /* Ensure body and html have proper sizing */
    html, body {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    /* Fix for iOS Safari viewport */
    @supports (-webkit-touch-callout: none) {
        .chat-area {
            height: -webkit-fill-available;
        }
    }
}

/* Mobile Devices (Landscape) and Small Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .app-container {
        flex-direction: column;
        position: relative;
    }
    
    .sidebar {
        width: 100%;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(0); /* Default visible */
        transition: transform 0.3s ease;
        background: var(--bg-secondary);
    }
    
    .sidebar.hidden-mobile {
        transform: translateX(-100%);
    }
    
    .chat-area {
        width: 100%;
        position: relative;
        z-index: 1;
    }
    
    .chat-area.hidden {
        display: none;
    }
    
    .message-content {
        max-width: 75%;
        min-width: 0;
    }
    
    .auth-box {
        margin: 20px;
        padding: 32px 24px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 24px;
        max-width: 90%;
    }
}

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 350px;
    }
    
    .message-content {
        max-width: 70%;
        min-width: 0;
    }
    
    .auth-box {
        max-width: 400px;
        padding: 40px 32px;
    }
    
    .modal-content {
        max-width: 600px;
    }
}

/* Desktop Small */
@media (min-width: 1025px) and (max-width: 1440px) {
    .sidebar {
        width: 380px;
    }
    
    .message-content {
        max-width: 65%;
        min-width: 0;
    }
}

/* Large Desktop */
@media (min-width: 1441px) {
    .sidebar {
        width: 420px;
    }
    
    .message-content {
        max-width: 60%;
        min-width: 0;
    }
    
    .auth-box {
        max-width: 480px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .contact-item,
    .menu-btn,
    .chat-actions button,
    .back-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .message-input input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .form-group input,
    .search-box input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .contact-avatar img,
    .profile-avatar-large img,
    .message-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ============================================
   RESET PASSWORD MODAL
   ============================================ */

.reset-link-info {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.reset-link-info p {
    margin: 8px 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.reset-link-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.reset-link-container {
    margin-top: 20px;
}

.reset-link-container label {
    display: block;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.reset-link-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.reset-link-input-group input {
    flex: 1;
    padding: 12px 15px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Courier New', monospace;
    word-break: break-all;
}

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

.btn-copy {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-copy:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-copy:active {
    transform: translateY(0);
}

.reset-link-note {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.reset-link-note i {
    margin-right: 6px;
    color: var(--primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
}

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

.modal-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--bg-quaternary);
    border-color: var(--primary);
    color: var(--primary);
}

/* ============================================
   ADMIN PANEL
   ============================================ */

.admin-container {
    width: 100%;
    height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.admin-header {
    padding: 20px 32px;
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-header-info h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-header-info h1 i {
    color: var(--primary);
}

.admin-header-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.admin-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-btn {
    padding: 12px 24px;
    background: var(--bg-quaternary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.admin-btn.danger {
    background: rgba(255, 71, 87, 0.1);
    border-color: var(--error);
    color: var(--error);
}

.admin-btn.danger:hover {
    background: rgba(255, 71, 87, 0.2);
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    -webkit-overflow-scrolling: touch;
}

.admin-dashboard h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s;
}

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

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-icon.online {
    background: var(--gradient-accent);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-search-box {
    display: flex;
    gap: 8px;
}

.admin-search-box input {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    width: 250px;
    outline: none;
}

.admin-search-box input:focus {
    border-color: var(--primary);
}

.admin-search-box button {
    padding: 12px 20px;
    background: var(--gradient-accent);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.admin-search-box button:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.admin-table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.admin-table thead {
    background: var(--bg-tertiary);
}

.admin-table th {
    padding: 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.admin-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 14px;
}

.admin-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.admin-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.status-badge,
.role-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.online {
    background: rgba(0, 255, 136, 0.2);
    color: var(--success);
}

.status-badge.offline {
    background: rgba(128, 128, 128, 0.2);
    color: var(--text-tertiary);
}

.role-badge.admin {
    background: rgba(255, 0, 110, 0.2);
    color: var(--secondary);
}

.role-badge.user {
    background: rgba(0, 212, 255, 0.2);
    color: var(--primary);
}

.admin-action-btn {
    padding: 8px 12px;
    background: var(--bg-quaternary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
    margin-right: 8px;
}

.admin-action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.admin-action-btn.danger:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(255, 71, 87, 0.1);
}

.message-preview {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge.danger {
    background: rgba(255, 71, 87, 0.2);
    color: var(--error);
}

.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px;
}

.admin-pagination button {
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
}

.admin-pagination button:hover {
    background: var(--bg-quaternary);
    border-color: var(--primary);
    color: var(--primary);
}

.admin-pagination span {
    color: var(--text-secondary);
    font-size: 14px;
}

.total-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.loading,
.error {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

.error {
    color: var(--error);
}

/* Admin Responsive */
@media (max-width: 768px) {
    .admin-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .admin-btn {
        width: 100%;
        justify-content: center;
    }
    
    .admin-content {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table {
        min-width: 720px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 6px;
    }

    /* Make actions cell wrap buttons instead of clipping */
    .admin-table td:last-child {
        min-width: 140px;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        align-items: center;
    }

    .admin-action-btn {
        width: 34px;
        height: 34px;
        padding: 6px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 6px;
    }
    
    .admin-search-box {
        width: 100%;
    }
    
    .admin-search-box input {
        width: 100%;
    }
}

/* Landscape Mobile Specific */
@media (max-width: 768px) and (orientation: landscape) {
    .auth-box {
        padding: 24px 20px;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .logo i {
        font-size: 40px;
    }
    
    .sidebar-header {
        padding: 12px 16px;
    }
    
    .chat-header {
        padding: 10px 16px;
    }
}

