/* ==========================================================================
   CoreSpaceX - Admin Portal Master Stylesheet (Light Mode Design System)
   Crisp, modern, high-contrast Light Mode UI optimized for Desktop & Mobile
   ========================================================================== */

:root {
    --admin-bg: #f8fafc;
    --admin-sidebar: #ffffff;
    --admin-card: #ffffff;
    --admin-border: #e2e8f0;
    --admin-text-primary: #0f172a;
    --admin-text-secondary: #64748b;
    --primary: #0284c7;
    --secondary: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --sidebar-width: 260px;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--admin-bg);
    color: var(--admin-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Admin Wrapper Layout --- */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--admin-bg);
}

/* --- Sidebar Styling --- */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--admin-sidebar);
    border-right: 1px solid var(--admin-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 2px 0 15px rgba(15, 23, 42, 0.03);
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-menu {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.menu-category {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--admin-text-secondary);
    padding: 0.8rem 1.5rem 0.4rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1.5rem;
    color: var(--admin-text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(2, 132, 199, 0.06);
    color: var(--primary);
}

.menu-item.active {
    background: rgba(2, 132, 199, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
}

.menu-item i {
    width: 20px;
    font-size: 1.05rem;
    text-align: center;
    color: var(--admin-text-secondary);
}

.menu-item.active i,
.menu-item:hover i {
    color: var(--primary);
}

/* --- Main Area & Header --- */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--admin-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.02);
}

.admin-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* --- Cards & Panels --- */
.panel-card {
    background: #ffffff;
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.03);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--admin-border);
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--admin-text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --- Form Controls --- */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--admin-text-primary);
    margin-bottom: 0.4rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    color: var(--admin-text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

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

/* --- Buttons & Badges --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.2rem;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.btn-outline {
    background: #ffffff;
    border: 1px solid var(--admin-border);
    color: var(--admin-text-primary);
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: var(--primary);
    color: var(--primary);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-primary {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
}

/* --- Login Page Light Mode Card --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid var(--admin-border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--admin-text-primary);
    margin-top: 0.5rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--admin-text-secondary);
}

/* ==========================================================================
   Mobile & Tablet Responsive Optimizations (@media max-width: 992px)
   ========================================================================== */

@media (max-width: 992px) {
    .admin-wrapper {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--admin-border);
    }

    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
    }

    .menu-category {
        display: none;
    }

    .menu-item {
        padding: 0.5rem 0.9rem;
        white-space: nowrap;
        border-left: none;
        border-bottom: 2px solid transparent;
        border-radius: 6px;
    }

    .menu-item.active {
        border-left: none;
        border-bottom-color: var(--primary);
    }

    /* Split-screen Studio Stacked Layout */
    .split-preview-layout {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }

    .controls-pane {
        max-height: none !important;
    }

    .preview-pane {
        height: 500px !important;
    }

    /* Chat Room Stacked Layout */
    .chat-room-layout {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }

    .chat-sidebar {
        order: 2;
    }

    .chat-main-card {
        order: 1;
        height: 520px !important;
    }
}
