:root {
    --primary-clr: #3b82f6;
    --primary-hover: #2563eb;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --terminal-bg: #000000;
    --terminal-text: #10b981;
    --danger: #ef4444;
    --success: #22c55e;
    
    --blur-intensity: blur(16px);
}

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

/* ═══════════════════════════════════════════════════════
   LUCIDE ICON SIZES
   ═══════════════════════════════════════════════════════ */

.icon-h1 {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    margin-left: 6px;
}

.icon-title {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-left: 4px;
}

.icon-sm {
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

.icon-xs {
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.icon-nav {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

.icon-user {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.icon-empty {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    margin: 0 auto 0.5rem;
    display: block;
    opacity: 0.5;
}

.icon-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.15);
}

.status-ok { color: var(--success); }
.status-fail { color: var(--danger); }

.history-chevron-icon {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.history-header.open .history-chevron-icon {
    transform: rotate(180deg);
}

body {
    font-family: 'Cairo', 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Animated Background Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 15s infinite alternate ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: #3b82f6;
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    bottom: -50px;
    left: -50px;
    animation-delay: -5s;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: #10b981;
    bottom: 20%;
    right: 20%;
    animation-duration: 20s;
}

@keyframes float {
    0% { transform: translateY(0) translateX(0); }
    100% { transform: translateY(30px) translateX(-30px); }
}

/* Glassmorphism Container */
.container {
    width: 90%;
    max-width: 800px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-intensity);
    -webkit-backdrop-filter: var(--blur-intensity);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: 2rem 0;
}

/* ═══════════════════════════════════════════════════════
   TOP NAV BAR
   ═══════════════════════════════════════════════════════ */

.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.2rem;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}


.nav-username {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: inherit;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.danger-btn-sm {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.danger-btn-sm:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════
   HEADER & CONTROLS
   ═══════════════════════════════════════════════════════ */

.header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #3b82f6, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.monospaced {
    font-family: 'Fira Code', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Controls */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

input {
    flex-grow: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    color: var(--text-primary);
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--primary-clr);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.btn {
    background: var(--primary-clr);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0 2rem;
    font-size: 1.1rem;
    font-family: 'Cairo', 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

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

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

.hidden {
    display: none !important;
}

.status-indicator {
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════
   TERMINAL
   ═══════════════════════════════════════════════════════ */

.terminal-container {
    margin-top: 2rem;
    background: var(--terminal-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 15px rgba(0,0,0,0.5);
}

.terminal-header {
    background: #2d3748;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
}

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

.mac-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.mac-btn.close { background: #ef4444; }
.mac-btn.min { background: #eab308; }
.mac-btn.max { background: #22c55e; }

.terminal-title {
    flex-grow: 1;
    text-align: center;
    font-size: 0.85rem;
    color: #a0aec0;
    margin-right: 44px;
}

.terminal-body {
    padding: 1rem;
    height: 350px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    color: var(--terminal-text);
    direction: ltr;
    text-align: left;
    scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
    width: 8px;
}
.terminal-body::-webkit-scrollbar-track {
    background: transparent;
}
.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.terminal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.log-line {
    margin-bottom: 4px;
    line-height: 1.4;
    word-break: break-all;
}

.welcome-msg {
    color: #3b82f6;
}

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

.log-success {
    color: var(--success);
}

/* Small loading pulse */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.pulsing {
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    color: #3b82f6;
}


/* ═══════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════ */

.login-container {
    max-width: 450px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.login-btn {
    width: 100%;
    padding: 0.85rem;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: var(--danger);
    font-size: 0.9rem;
    text-align: center;
}


/* ═══════════════════════════════════════════════════════
   ADMIN DASHBOARD
   ═══════════════════════════════════════════════════════ */

.admin-container {
    max-width: 700px;
}

.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.admin-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-section {
    margin-top: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.2rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header-row .section-title {
    margin-bottom: 0;
}

.section-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.refresh-btn {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
}

.add-user-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.form-row {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
}

.add-btn {
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
    white-space: nowrap;
    height: fit-content;
}

.form-msg {
    font-size: 0.85rem;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    text-align: center;
}

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

.msg-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--success);
}

/* Users List */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-users {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    opacity: 0.7;
}

.loading-msg {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
}

.user-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

.user-card:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.12);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}


.user-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-creds {
    display: flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
}

.cred-value {
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.user-date {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
    opacity: 0.6;
    direction: ltr;
}


/* ═══════════════════════════════════════════════════════
   STATS CHIPS
   ═══════════════════════════════════════════════════════ */

.admin-stats-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0.8rem;
    padding: 0.6rem 0.8rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.admin-stats-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.admin-stats-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.user-stats-row {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.stat-chip {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.stat-total {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.stat-ok {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.stat-err {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ═══════════════════════════════════════════════════════
   ADMIN HISTORY LOG
   ═══════════════════════════════════════════════════════ */

.history-log-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.history-log-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    animation: slideIn 0.3s ease;
}

.history-log-item:hover {
    background: rgba(30, 41, 59, 0.8);
}

.history-log-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-log-account {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.history-log-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    direction: ltr;
}

.history-log-by {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.history-log-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
    opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════
   HISTORY SECTION
   ═══════════════════════════════════════════════════════ */

.history-section {
    margin-top: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: rgba(15, 23, 42, 0.5);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem;
    cursor: pointer;
    transition: background 0.3s ease;
    user-select: none;
}

.history-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.history-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}


.history-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.history-badge {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}


.history-content {
    max-height: 600px;
    overflow-y: auto;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
    padding: 0 1.2rem 1.2rem;
    opacity: 1;
}

.history-content.collapsed {
    max-height: 0;
    padding: 0 1.2rem;
    opacity: 0;
    overflow: hidden;
}

.history-content::-webkit-scrollbar {
    width: 6px;
}
.history-content::-webkit-scrollbar-track {
    background: transparent;
}
.history-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.history-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}


.history-empty p {
    font-size: 0.95rem;
    opacity: 0.7;
}

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

.history-item {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    transition: all 0.3s ease;
    animation: slideIn 0.35s ease;
}

.history-item:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateX(-3px);
}

.history-item.history-success {
    border-right: 3px solid var(--success);
}

.history-item.history-fail {
    border-right: 3px solid var(--danger);
}

.history-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.history-name {
    display: flex;
    align-items: center;
    gap: 8px;
}


.history-account-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.history-date {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
    opacity: 0.7;
    direction: ltr;
}

.history-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-session {
    display: flex;
    align-items: center;
    gap: 6px;
    direction: ltr;
}

.session-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.session-value {
    font-family: 'Fira Code', monospace;
    font-size: 0.78rem;
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}


.danger-btn {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
    width: 100%;
    margin-top: 12px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    gap: 6px;
}

.danger-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}


/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */

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

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(30px);
        max-height: 0;
        padding: 0;
        margin: 0;
        border: 0;
    }
}


/* ═══════════════════════════════════════════════════════
   MOBILE RESPONSIVENESS
   ═══════════════════════════════════════════════════════ */

@media (max-width: 650px) {
    .container {
        padding: 1.5rem;
        margin: 1rem 0;
        width: 95%;
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .header p {
        font-size: 0.95rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn {
        width: 100%;
        padding: 0.8rem 0;
    }
    
    .terminal-body {
        height: 250px;
        font-size: 0.85rem;
    }
    
    .terminal-title {
        margin-right: 0;
        padding-right: 15px;
    }

    .top-nav {
        flex-direction: column;
        gap: 0.8rem;
    }

    .admin-header-row {
        flex-direction: column;
        text-align: center;
    }

    .form-row {
        flex-direction: column;
    }

    .add-btn {
        width: 100%;
    }

    .history-item-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .history-item-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-session {
        flex-wrap: wrap;
    }

    .user-card {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}
