/* ============================================
   FRAKPANEL - MODERN UI v2.0
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* Dark Theme Colors */
    --bg-dark: #0a0a0b;
    --bg-surface: #111113;
    --bg-elevated: #18181b;
    --bg-hover: #1f1f23;
    
    /* Accent - Electric Purple/Blue */
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-dark: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.4);
    
    /* Text */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Borders */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.1);
    
    /* Status Colors */
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Spacing */
    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   LAYOUT
   ============================================ */
.dashboard-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    flex-shrink: 0;
    padding: 1.25rem;
    overflow-y: auto;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.5rem;
    margin-bottom: 1.5rem;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.brand-text {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    flex: 1;
}

.brand-badge {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
    color: #000;
    font-size: 0.6rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Search */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px 10px 38px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    transition: all 0.2s;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Nav Sections */
.nav-group {
    margin-bottom: 1.75rem;
}

.nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0 0.5rem;
    margin-bottom: 0.6rem;
}

.nav-group-badge {
    background: var(--bg-elevated);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.55rem;
    color: var(--text-secondary);
}

.nav-group-badge.admin {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* Nav Items */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    position: relative;
}

.nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    opacity: 0.7;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link:hover i {
    opacity: 1;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), transparent);
    color: var(--accent-light);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-link.active i {
    opacity: 1;
    color: var(--accent-light);
}

.nav-tag {
    margin-left: auto;
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    font-weight: 600;
}

/* Sidebar Footer / User */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--info));
    background-size: cover;
    background-position: center;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 0.7rem;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
}

.user-logout {
    color: var(--text-muted);
    font-size: 1rem;
    padding: 5px;
    transition: 0.2s;
}

.user-logout:hover {
    color: var(--danger);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-dark);
    padding: 2rem 2.5rem;
}

/* Content Header */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.content-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.header-buttons {
    display: flex;
    gap: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-ghost {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* ============================================
   CARDS & PANELS
   ============================================ */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Welcome Hero */
.hero-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-greeting {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero-greeting span {
    background: linear-gradient(90deg, var(--accent-light), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 500px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 1rem;
}

.hero-badge::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.4; }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s;
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--accent); }
.stat-icon.green { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.stat-icon.orange { background: rgba(249, 115, 22, 0.15); color: #f97316; }

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-change {
    font-size: 0.7rem;
    color: var(--success);
    margin-top: 4px;
}

.stat-change.negative {
    color: var(--danger);
}

/* Action Cards Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.action-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.action-card:hover {
    border-color: var(--accent);
    background: var(--bg-elevated);
    transform: translateY(-2px);
}

.action-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.action-content h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.action-content p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   TABLES
   ============================================ */
.custom-table {
    width: 100%;
    border-collapse: collapse;
}

.custom-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.custom-table th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.custom-table th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.custom-table td {
    padding: 14px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.custom-table tbody tr:hover {
    background: var(--bg-hover);
}

.custom-table tbody tr:last-child td {
    border-bottom: none;
}

/* Badge */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-light);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================
   Tab Placeholder Content
   ============================================ */
.placeholder-content {
    text-align: center;
    padding: 4rem 2rem;
}

.placeholder-content i {
    font-size: 4rem;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.placeholder-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.placeholder-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    padding: 2rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 30px var(--accent-glow);
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .btn-primary {
    width: 100%;
    padding: 12px;
    margin-top: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.login-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -100%;
        z-index: 1000;
        transition: 0.3s;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .main-content {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-card {
        padding: 1.5rem;
    }
    
    .hero-greeting {
        font-size: 1.25rem;
    }
}
