/* ============================================
   MUSICFFY ADMIN PANEL - CSS DESIGN SYSTEM
   Dark theme matching main Musicffy site
   ============================================ */

/* ============================================
   CSS VARIABLES (Design Tokens)
   ============================================ */
:root {
    /* Colors */
    --primary: #818cf8;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary: #f472b6;
    --accent: #22d3ee;
    
    /* Semantic Colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    
    /* Background */
    --bg: #030014;
    --bg-secondary: #0a0a1a;
    --bg-card: rgba(30, 27, 75, 0.4);
    --bg-card-hover: rgba(30, 27, 75, 0.6);
    --bg-sidebar: rgba(10, 10, 26, 0.95);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-input-focus: rgba(255, 255, 255, 0.1);
    
    /* Text */
    --text: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-disabled: #64748b;
    
    /* Borders */
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --border-focus: var(--primary);
    
    /* Effects */
    --glass: rgba(255, 255, 255, 0.05);
    --glow: 0 0 20px rgba(99, 102, 241, 0.5);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.08), transparent 25%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    line-height: 1.3;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-light);
}

/* ============================================
   LAYOUT - SIDEBAR + MAIN
   ============================================ */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-normal);
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-badge {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-bottom: var(--space-1);
}

.nav-item:hover {
    background: var(--glass);
    color: var(--text);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.2), rgba(129, 140, 248, 0.1));
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 600;
}

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

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-profile:hover {
    background: var(--glass);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

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

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.topbar {
    position: sticky;
    top: 0;
    background: rgba(3, 0, 20, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb-separator {
    color: var(--text-disabled);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

/* Notification Bell */
.notification-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.notification-bell:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-hover);
}

.notification-bell .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    animation: pulse-badge 2s infinite;
}

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

/* Page Content */
.page-content {
    flex: 1;
    padding: var(--space-6);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-hover);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-title i {
    color: var(--primary);
}

/* Stats Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: all var(--transition-normal);
}

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

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

.stat-icon.primary {
    background: rgba(129, 140, 248, 0.15);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-change {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.8rem;
    margin-top: var(--space-2);
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(79, 70, 229, 0.5);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-input-focus);
    border-color: var(--border-hover);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: var(--space-2);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text);
    background: var(--glass);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.8rem;
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-2);
    font-size: 0.9rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    background: var(--bg-input-focus);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

.form-input::placeholder {
    color: var(--text-disabled);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .form-input {
    padding-left: 44px;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ============================================
   BADGES & STATUS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(129, 140, 248, 0.15);
    color: var(--primary);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.status-dot.success { background: var(--success); }
.status-dot.warning { background: var(--warning); }
.status-dot.danger { background: var(--danger); }
.status-dot.pending { background: var(--text-muted); }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.danger { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

.toast-icon {
    font-size: 1.25rem;
}

.toast.success .toast-icon { color: var(--success); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.danger .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: var(--space-1);
}

.toast-close:hover {
    color: var(--text);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-logo p {
    color: var(--text-muted);
    margin-top: var(--space-2);
}

.login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    font-size: 0.9rem;
    display: none;
}

.login-error.show {
    display: block;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-2);
    color: var(--text);
}

.empty-state p {
    font-size: 0.95rem;
}

/* ============================================
   LOADING
   ============================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 0, 20, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-content {
        padding: var(--space-4);
    }
    
    .topbar {
        padding: var(--space-3) var(--space-4);
    }
    
    .card {
        padding: var(--space-4);
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.85rem; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
