/**
 * Danbot Admin Dashboard - Admin-Specific Styles
 *
 * File: styles/css/admin.css
 * Created: [Current Date]
 *
 * This file contains all admin-specific styles extracted from admin.html's internal <style> block.
 * It is scoped to avoid conflicts with the global styles.css design system.
 *
 * @module Admin Styles
 */

/* =====================================================
   Root Variables & Theme Overrides
   ===================================================== */
:root {
    --bg-color: #f0f0ff;
    --bg-gradient: linear-gradient(135deg, #f0f0ff 0%, #e8e8ff 50%, #f5f3ff 100%);
    --text-color: #1e1b4b;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-bg-solid: #ffffff;
    --border-color: rgba(139, 92, 246, 0.15);
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-glow: rgba(124, 58, 237, 0.15);
    --sidebar-bg: rgba(255, 255, 255, 0.8);
    --sidebar-hover: rgba(139, 92, 246, 0.06);
    --sidebar-active: rgba(139, 92, 246, 0.1);
    --modal-bg: rgba(30, 27, 75, 0.6);
    --danger-color: #ef4444;
    --success-color: #10b981;
    --glass-blur: 12px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 1px 3px rgba(124, 58, 237, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    --shadow-card-hover: 0 4px 16px rgba(124, 58, 237, 0.12), 0 8px 24px rgba(0, 0, 0, 0.06);
    --sidebar-accent: linear-gradient(180deg, #8b5cf6 0%, #6d28d9 100%);
}

[data-theme="dark"] {
    --bg-color: #0b0a1a;
    --bg-gradient: linear-gradient(135deg, #0b0a1a 0%, #15132e 40%, #1a1040 70%, #0f0e24 100%);
    --text-color: #e2e8f0;
    --card-bg: rgba(30, 27, 75, 0.5);
    --card-bg-solid: #1e1b4b;
    --border-color: rgba(139, 92, 246, 0.2);
    --primary-color: #a78bfa;
    --primary-hover: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.2);
    --sidebar-bg: rgba(15, 14, 36, 0.85);
    --sidebar-hover: rgba(139, 92, 246, 0.1);
    --sidebar-active: rgba(139, 92, 246, 0.18);
    --modal-bg: rgba(5, 5, 15, 0.85);
    --glass-blur: 16px;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(139, 92, 246, 0.06);
    --shadow-card-hover: 0 4px 16px rgba(139, 92, 246, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
    --sidebar-accent: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
}

/* =====================================================
   General Body Styles
   ===================================================== */
body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* =====================================================
   Login Modal Styles
   ===================================================== */
#login-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-gradient);
    display: flex; justify-content: center; align-items: center;
    z-index: 3000;
}
.login-box {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-card-hover);
    border: 1px solid var(--border-color);
    text-align: center;
}
.login-box h2 { margin-top: 0; margin-bottom: 1.5rem; }
.login-box input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
    color: var(--text-color);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.login-box button {
    width: 100%;
    padding: 0.75rem;
    background: var(--sidebar-accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}
.login-box button:hover { opacity: 0.9; }
.login-box button:active { transform: scale(0.98); }
.error-msg { color: var(--danger-color); font-size: 0.85rem; margin-top: 0.5rem; display: none; }

/* =====================================================
   Dashboard App Layout Styles
   ===================================================== */
#dashboard {
    display: none;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, transparent 100%);
}

.sidebar-nav {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

.nav-item {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
    font-size: 0.9rem;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--sidebar-accent);
    border-radius: 0 4px 4px 0;
    transition: transform 0.2s ease;
}

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

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-item.active::before {
    transform: translateY(-50%) scaleY(1);
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-footer button, .sidebar-footer a {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 0.5rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: background 0.2s;
}
.sidebar-footer button:hover, .sidebar-footer a:hover {
    background-color: var(--sidebar-hover);
}
.sidebar-footer .sign-out {
    color: var(--danger-color);
}

/* Mobile Header Styles */
.mobile-header {
    display: none;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--sidebar-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    align-items: center;
    gap: 1rem;
}
.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
}

/* =====================================================
   Main Content Styles
   ===================================================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
}

.top-bar h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-color) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar p {
    color: var(--text-color);
    opacity: 0.6;
    margin: 0.25rem 0 0 0;
    font-size: 0.85rem;
}

.btn-refresh {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--sidebar-accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    transition: opacity 0.2s, transform 0.1s;
}
.btn-refresh:hover { opacity: 0.9; }
.btn-refresh:active { transform: scale(0.97); }

/* =====================================================
   Tab Content Styles
   ===================================================== */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* =====================================================
   Cards Grid Styles
   ===================================================== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-card);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--sidebar-accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.clickable-card { cursor: pointer; }
.clickable-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}
.clickable-card:hover::before {
    opacity: 1;
}

.card-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.6;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.card-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

/* =====================================================
   Loading Spinner Styles
   ===================================================== */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   Data Container & Table Styles
   ===================================================== */
.data-container {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
}
.data-container-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
}

.table-wrapper {
    overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.85rem; }
th, td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); }
th {
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(139, 92, 246, 0.02) 100%);
}
tr:last-child td { border-bottom: none; }
.clickable { cursor: pointer; color: var(--primary-color); text-decoration: underline; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--sidebar-active);
    border: 1px solid var(--border-color);
}

/* =====================================================
   Data Modal Styles
   ===================================================== */
.data-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--modal-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none; justify-content: center; align-items: center;
    z-index: 2000;
}
.data-modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card-hover);
    border: 1px solid var(--border-color);
}
.data-modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.data-modal-header h2 { margin: 0; font-size: 1.1rem; }
.close-modal { cursor: pointer; font-size: 1.5rem; background: none; border: none; color: var(--text-color); }
.data-modal-body {
    padding: 0;
    overflow-y: auto;
    position: relative;
    min-height: 200px;
}
.data-modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.85rem;
}
.data-modal-footer button {
    padding: 0.4rem 0.8rem;
    background: var(--sidebar-active);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.data-modal-footer button:disabled { opacity: 0.5; cursor: not-allowed; }
.data-modal-footer button:hover:not(:disabled) { background: var(--sidebar-hover); }

/* =====================================================
   Sub Modal for Groups Styles
   ===================================================== */
#sub-modal-content { max-width: 400px; }
.group-tag { display: inline-block; padding: 0.25rem 0.5rem; background: var(--sidebar-active); border-radius: var(--radius-sm); margin: 0.2rem; font-size: 0.75rem; border: 1px solid var(--border-color); }

/* =====================================================
   Loading Modal Spinner Styles
   ===================================================== */
.loading-modal-spinner {
    position: absolute; top: 50%; left: 50%;
    margin-top: -15px; margin-left: -15px;
    width: 30px; height: 30px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    display: none;
}

/* =====================================================
   Mobile Adjustments
   ===================================================== */
@media (max-width: 768px) {
    #dashboard { flex-direction: column; display: none; }
    #dashboard.active-flex { display: flex; }
    .mobile-header { display: flex; }
    .sidebar {
        position: fixed;
        top: 0; left: 0; height: 100%;
        z-index: 2000;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay {
        display: none;
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1500;
    }
    .sidebar-overlay.open { display: block; }
    .main-content { padding: 1rem; }
    .top-bar { display: none; } /* Hide main top bar since mobile has header */
}

/* =====================================================
   Toggle Switch Styles
   ===================================================== */
.switch { position: relative; display: inline-block; width: 36px; height: 18px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 18px; }
.slider:before { position: absolute; content: ""; height: 14px; width: 14px; left: 2px; bottom: 2px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(18px); }
