/**
 * Admin Panel Styles - Celestial Theme
 * Modern Dark Mode with Glassmorphism
 */

:root {
    /* Colors */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --primary: #d97706;
    --primary-light: #fbbf24;
    --primary-glow: rgba(217, 119, 6, 0.3);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.95);
    /* Much darker and almost opaque */
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    /* Status Colors */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 70px;
}

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

body {
    font-family: 'Lato', sans-serif;
    background: radial-gradient(circle at top right, #1e293b, #0f172a 60%, #020617);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: 'Cinzel', serif;
    color: var(--primary-light);
    font-weight: 700;
}

/* Glassmorphism Utility */
.glass-panel {
    background: #0f172a;
    /* Fallback */
    background: rgba(15, 23, 42, 0.98);
    /* Almost opaque */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

/* Login Screen */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: url('../images/hero_background_galaxy_1763570603913.png') center/cover no-repeat fixed;
    /* Optional bg */
}

.login-container::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    z-index: -1;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 40px;
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.login-header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    background: linear-gradient(to right, var(--primary-light), var(--primary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-muted);
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
}

/* Admin Layout */
.admin-layout {
    display: none;
    /* Hidden by default until logged in */
    min-height: 100vh;
    padding-left: var(--sidebar-width);
}

.admin-layout.active {
    display: block;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    /* Override glass-panel radius */
    border-right: 1px solid var(--glass-border);
    border-top: none;
    border-bottom: none;
    border-left: none;
    background: #020617;
    /* Solid dark background for sidebar */
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    /* Ensure background is applied */
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.2rem;
    color: #000;
    margin: 0 auto 15px;
    box-shadow: 0 0 20px var(--primary-glow);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px 25px;
    background: transparent;
    border: none;
    color: #cbd5e1;
    /* Brighter text */
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    border-left: 3px solid transparent;
}

.nav-item i {
    width: 25px;
    margin-right: 10px;
    font-size: 1.1rem;
}

.nav-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--primary-light);
    background: rgba(217, 119, 6, 0.1);
    border-left-color: var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.btn-icon:hover {
    color: var(--primary-light);
}

/* Main Content */
.main-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    margin-bottom: 30px;
}

.header-title h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.form-control,
input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    transition: all 0.3s;
}

.form-control:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
    background: rgba(0, 0, 0, 0.4);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #000;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-icon-only {
    padding: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Builder Specifics */
.builder-toolbar {
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    justify-content: space-between;
}

.page-selector {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.builder-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.sections-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s;
}

.section-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.section-header {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
}

.section-title {
    font-weight: 600;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-actions {
    display: flex;
    gap: 5px;
}

.section-body {
    padding: 20px;
}

/* Quill Overrides for Dark Mode */
.ql-toolbar.ql-snow {
    border-color: var(--glass-border) !important;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px 8px 0 0;
}

.ql-container.ql-snow {
    border-color: var(--glass-border) !important;
    background: #fff;
    /* Keep editor white for WYSIWYG accuracy */
    color: #000;
    border-radius: 0 0 8px 8px;
    min-height: 150px;
}

/* Force black text in editor to avoid white-on-white from global styles */
.ql-editor p,
.ql-editor h1,
.ql-editor h2,
.ql-editor h3,
.ql-editor h4,
.ql-editor h5,
.ql-editor h6,
.ql-editor li,
.ql-editor span,
.ql-editor div {
    color: #000 !important;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.gallery-item {
    padding: 15px;
    text-align: center;
}

.gallery-preview {
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    background: #000;
}

.gallery-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-info h4 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

/* Colors Grid */
.colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.color-control {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.color-picker-wrapper {
    display: flex;
    gap: 10px;
}

.color-picker-wrapper input[type="color"] {
    width: 50px;
    padding: 0;
    border: none;
    height: 40px;
    cursor: pointer;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .admin-layout {
        padding-left: 0;
        padding-bottom: 70px;
        /* Space for bottom nav */
    }

    .sidebar {
        width: 100%;
        height: auto;
        top: auto;
        bottom: 0;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--glass-border);
        background: var(--bg-darker);
    }

    .sidebar-header,
    .sidebar-footer {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        padding: 0;
        justify-content: space-around;
    }

    .nav-item {
        flex-direction: column;
        padding: 10px;
        font-size: 0.7rem;
        text-align: center;
        border-left: none;
        border-top: 3px solid transparent;
        gap: 5px;
    }

    .nav-item i {
        margin: 0;
        font-size: 1.2rem;
    }

    .nav-item.active {
        border-top-color: var(--primary);
    }

    .main-content {
        padding: 15px;
    }

    .content-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}