/* PhoenixPHP Dashboard — CDAC Programming */
/* Modern dark theme with phoenix amber accents */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1c2a4a;
    --bg-sidebar: #0a0a14;
    --bg-input: #1e2a45;
    --text-primary: #e8e8f0;
    --text-secondary: #8892b0;
    --text-muted: #5a6380;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.15);
    --success: #10b981;
    --danger: #ef4444;
    --info: #3b82f6;
    --warning: #f59e0b;
    --border: #2a2a4a;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ======== LOGIN PAGE ======== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    top: -200px;
    right: -200px;
    border-radius: 50%;
    animation: pulse-glow 4s ease-in-out infinite;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08), transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
    animation: pulse-glow 5s ease-in-out infinite reverse;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; }
}

.login-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

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

.login-logo .logo-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.4));
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.login-logo h1 span { color: var(--accent); }

.login-logo p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #000;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

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

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

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-info { background: var(--info); color: #fff; }

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

/* ======== SIDEBAR ======== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-header .brand-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

.sidebar-header .brand-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-header .brand-text span { color: var(--accent); }

.sidebar-header .brand-sub {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

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

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

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

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    border-left: 3px solid var(--accent);
}

.nav-item i { width: 20px; text-align: center; font-size: 16px; }

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--info));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #000;
}

.user-info { flex: 1; }
.user-info .name { font-size: 14px; font-weight: 600; }
.user-info .role { font-size: 12px; color: var(--text-muted); }

/* ======== MAIN CONTENT ======== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 0;
}

.topbar {
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
}

.topbar h2 {
    font-size: 22px;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-area {
    padding: 32px;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at top right, var(--accent-glow), transparent 70%);
    border-radius: 0 var(--radius) 0 0;
}

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

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.stat-card .stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent); }
.stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.stat-card .stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-card .stat-icon.red { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -1px;
}

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

.stat-card .stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 4px;
}

.stat-change.up { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-change.down { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* ======== CONTENT CARDS ======== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.card-body { padding: 24px; }

/* ======== GRID LAYOUTS ======== */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

/* ======== TABLE ======== */
.table-wrapper { overflow-x: auto; }

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

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

.phoenix-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(42, 42, 74, 0.5);
}

.phoenix-table tr:hover td {
    background: var(--bg-card-hover);
}

/* ======== BADGES ======== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }

/* ======== ACTIVITY FEED ======== */
.activity-feed { list-style: none; }

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(42, 42, 74, 0.3);
}

.activity-item:last-child { border: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-dot.green { background: var(--success); box-shadow: 0 0 8px var(--success); }
.activity-dot.amber { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.activity-dot.blue { background: var(--info); box-shadow: 0 0 8px var(--info); }
.activity-dot.red { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.activity-text { font-size: 13px; color: var(--text-secondary); }
.activity-text strong { color: var(--text-primary); }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ======== CHART CONTAINER ======== */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ======== SYSTEM STATUS ======== */
.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(42, 42, 74, 0.3);
}

.status-row:last-child { border: none; }

.status-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: status-pulse 2s ease-in-out infinite;
}

.status-indicator.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-indicator.warning { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-indicator.offline { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

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

.status-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ======== CODE BLOCK ======== */
.code-block {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    overflow-x: auto;
    line-height: 1.8;
}

.code-block .keyword { color: #c792ea; }
.code-block .string { color: #c3e88d; }
.code-block .comment { color: var(--text-muted); font-style: italic; }
.code-block .func { color: #82aaff; }
.code-block .var { color: #f78c6c; }

/* ======== MODULE CARDS ======== */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent);
}

.module-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.module-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.module-card-header h3 { font-size: 18px; font-weight: 700; }
.module-card-header .module-version { font-size: 12px; color: var(--text-muted); }

.module-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.module-features {
    list-style: none;
    margin-bottom: 20px;
}

.module-features li {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 0;
}

.module-features li::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--success);
    margin-right: 8px;
    font-size: 10px;
}

.module-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.module-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
}

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

/* ======== MOBILE MENU TOGGLE ======== */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border: none;
    color: #000;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.mobile-menu-toggle:hover { transform: scale(1.05); }

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
    backdrop-filter: blur(4px);
}

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

/* ======== RESPONSIVE ======== */
@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .sidebar {
        transform: translateX(-100%);
        z-index: 150;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-toggle { display: flex; align-items: center; justify-content: center; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content-area { padding: 16px; }
    .login-card { margin: 16px; padding: 32px; }
    .topbar { padding: 12px 16px; }
    .topbar h2 { font-size: 18px; }
    .module-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}
