/**
 * Global Admin Dashboard Stylesheet (Dark Theme)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #38bdf8;
    --primary-hover: #0ea5e9;
    --accent: #a855f7;
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;

    --sidebar-width: 260px;
    --transition-speed: 0.25s;
    --border-radius: 8px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

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

/* Sidebar Layout */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 24px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all var(--transition-speed);
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

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

.header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
}

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

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--border-color);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content-body {
    padding: 32px;
    flex: 1;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Grid System */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* Stat Box */
.stat-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.stat-box::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
}

/* Table Design */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

th {
    text-align: left;
    padding: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    transition: border-color var(--transition-speed);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #0f172a;
}
.btn-primary:hover {
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
    background: var(--primary);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: #475569;
}

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

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background-color: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-danger { background-color: rgba(244, 63, 94, 0.2); color: var(--danger); }
.badge-warning { background-color: rgba(245, 158, 11, 0.2); color: var(--warning); }

/* Progress Bar */
.progress-bar-container {
    background-color: var(--bg-main);
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
    margin-top: 10px;
}
.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    height: 100%;
}

/* Template Grid list */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
}

.template-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.template-thumb {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--bg-main);
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--border-color);
}

.template-info {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.template-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

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

.template-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Alert dialogs */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background-color: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); color: var(--success); }
.alert-danger { background-color: rgba(244, 63, 94, 0.1); border: 1px solid var(--danger); color: var(--danger); }

/* Quick Generate Modal styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    padding: 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}
.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
}
.close-modal:hover { color: var(--text-primary); }

/* Utility styles */
.text-center { text-align: center; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-speed);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-layout {
        margin-left: 0;
    }
    .header {
        padding: 16px;
    }
}
