/* ============================================
   AMIRA Web Interface - Modern Dark Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Open+Sans:wght@300;400;500;600;700&family=Nunito:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #006A63;
    --secondary-color: #f3a213;
    --light-bg: #f6f9ff;
    --text-dark: #000000;
    --text-light: #ffffff;
    
    /* Legacy variables for compatibility */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #15151f;
    --bg-hover: #1e1e2d;
    
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --border-color: #2a2a3a;
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    scroll-behavior: smooth;
}

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

body {
    font-family: "Open Sans", sans-serif;
    background: var(--light-bg, var(--bg-primary));
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: "Nunito", sans-serif;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   LAYOUT
   ============================================ */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar base styles moved to SIDEBAR section below */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    padding: 20px;
    background: var(--primary-color, #006A63);
    z-index: 996;
    overflow-y: auto;
    transition: all 0.3s;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color, #006A63) transparent;
    box-shadow: 0 0 20px rgba(1, 41, 112, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
    height: 8px;
    background: #fff;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color, #006A63);
}

.sidebar-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0 0 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
    gap: 12px;
}

.logo {
    flex: 1;
    min-width: 0;
    line-height: 1;
}

.logo h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-light, #ffffff);
    font-family: "Nunito", sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}

.logo h1 span {
    font-size: 28px;
}

.logo p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
    margin-bottom: 0;
}

.sidebar-close-btn {
    display: none; /* Hidden on desktop */
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-light, #ffffff);
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light, #ffffff);
    transform: scale(1.05);
}

.sidebar-close-btn:active {
    transform: scale(0.95);
}

.sidebar-close-btn i {
    font-size: 18px;
}

.nav-menu {
    flex: 1;
    padding: 0;
    margin: 0;
    list-style: none;
}

.nav-item {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-light, #ffffff);
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 4px;
    text-decoration: none;
    transition: 0.3s;
    margin-bottom: 5px;
    gap: 10px;
}

.nav-item i {
    font-size: 16px;
    width: 24px;
    color: var(--text-light, #ffffff);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--secondary-color, #f3a213);
}

.nav-item:hover i {
    color: var(--secondary-color, #f3a213);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.25);
    color: var(--text-light, #ffffff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-section {
    padding: 20px 0 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: auto;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

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

/* ============================================
   CHAT INTERFACE
   ============================================ */
.chat-header {
    padding: 20px 30px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1002; /* Above sidebar and overlay */
}

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

.chat-title h2 {
    font-size: 20px;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--success);
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.chat-action-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1001; /* Above overlay */
}

/* Menu toggle button specific styling */
.menu-toggle-btn {
    z-index: 1003 !important;
    pointer-events: auto !important;
}

.chat-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message.bot .message-avatar {
    background: var(--accent-gradient);
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}

.message.user .message-content {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.message-text {
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.message-text strong, .message-text b {
    font-weight: 600;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

.message.user .message-time {
    color: rgba(255,255,255,0.7);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

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

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

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

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

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: var(--transition);
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: var(--accent-gradient);
    border: none;
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: var(--shadow-glow);
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.3);
}

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

.send-btn i {
    font-size: 20px;
    color: white;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.quick-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.quick-btn:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ============================================
   ADMIN PAGE
   ============================================ */
.page-header {
    padding: 30px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: flex-start;
    gap: 15px;
    position: relative;
    z-index: 1002; /* Above sidebar and overlay */
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

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

.page-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 16px;
}

.stat-icon.purple { background: rgba(99, 102, 241, 0.15); color: var(--accent-primary); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--info); }

.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

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

/* Data Table */
.data-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.section-title {
    font-size: 16px;
    font-weight: 600;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

.data-table th,
.data-table td {
    padding: 16px 24px;
    text-align: left;
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.data-table tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.data-table td {
    font-size: 14px;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-cell .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin { background: rgba(139, 92, 246, 0.2); color: var(--accent-secondary); }
.badge-user { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.badge-active { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-inactive { background: rgba(107, 107, 123, 0.2); color: var(--text-muted); }

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

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    animation: modalIn 0.3s ease;
}

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

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

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

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

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

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

.form-input,
.form-select {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-select {
    cursor: pointer;
    appearance: none;
    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='%236b6b7b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

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

.login-logo h1 {
    font-size: 36px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

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

.login-btn {
    width: 100%;
    background: var(--accent-gradient);
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Alert Messages */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* Hide menu buttons on desktop */
.menu-toggle-btn,
.menu-open-btn {
    display: none;
}

@media (max-width: 768px) {
    /* Show menu open button on mobile (in header) */
    .menu-open-btn {
        display: flex !important;
        position: relative;
        z-index: 1003; /* Above everything */
    }
    
    /* Show menu close button on mobile (in sidebar) */
    .sidebar-close-btn {
        display: flex !important;
    }
    
    /* Ensure chat header is above sidebar */
    .chat-header {
        z-index: 1002 !important;
    }
    
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100%;
        z-index: 1000;
        transition: var(--transition);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.active {
        left: 0;
        z-index: 1001; /* Above overlay */
    }
    
    /* Add overlay when sidebar is active using body class */
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        animation: fadeIn 0.3s ease;
        cursor: pointer;
    }
    
    .message {
        max-width: 95%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chat-header, .chat-input-container {
        padding: 15px 20px;
    }
    
    .chat-messages {
        padding: 20px;
    }
}

