:root {
    /* Brand & Accents */
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --primary-glow: rgba(124, 58, 237, 0.4);

    /* Surfaces (Default to Dark for Guest/Initial load) */
    --bg-body: #0f0f1a;
    --bg-card: #282848;
    --bg-card-hover: #23233c;
    --bg-input: #23233c;
    --bg-table-header: rgba(124, 58, 237, 0.05);

    /* Text */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-brand: #f8fafc;

    /* Status */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Borders & UI */
    --border: rgba(255, 255, 255, 0.05);
    --border-focus: var(--accent);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Effects */
    --header-height: 72px;
    --glass-blur: none;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    background-image: var(--bg-gradient);
    transition: background-color 0.3s, color 0.3s;
}

/* Layout Containers */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.welcome-portal-container {
    width: 95%;
    max-width: 1700px;
    /* Slightly wider than 1600 */
    margin: 0 auto;
    padding: 4rem 2rem;
    /* Replaces py-16 (4rem) */
}

.container-sm {
    max-width: 800px;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

p.subtitle {
    color: var(--text-muted);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

/* Components: Card (Glassmorphic) */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, background-color 0.2s;
}

.glass-card:hover {
    transform: translateY(-2px);
    background: var(--bg-card-hover, var(--bg-card));
}

/* Reset for cards used as links */
a.glass-card,
a.card {
    text-decoration: none;
    color: inherit;
    display: block;
}

a.glass-card *,
a.card * {
    text-decoration: none !important;
}

.welcome-text {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

/* Components: Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Components: Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    width: 100%;
}

/* Components: Loading Spinner */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
    /* Hidden by default */
}

.btn .spinner {
    margin-right: 0.5rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Components: Stats Grid (Dashboard) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 0.5rem;
}

.stat-desc {
    font-size: 0.875rem;
    color: var(--success);
    margin-top: 0.25rem;
}

/* Components: Data Table */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.datatable {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.datatable th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-table-header);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.datatable td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.datatable tr:last-child td {
    border-bottom: none;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mt-8 {
    margin-top: 2rem;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--text-muted);
}

.p-4 {
    padding: 1rem;
}

.py-16 {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Theme Selector Components */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.theme-option {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.theme-option:hover {
    border-color: var(--primary);
}

.theme-option.active {
    border-color: var(--success);
    background: rgba(0, 188, 140, 0.1);
}

.theme-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 0.5rem;
    overflow: hidden;
}

.preview-header {
    height: 20%;
    width: 100%;
}

.preview-content {
    padding: 8%;
    display: flex;
    gap: 8%;
    height: 80%;
}

.preview-card {
    flex: 1;
    border-radius: 4px;
}

/* Theme Previews */
.theme-preview-dark {
    background: #222;
}

.theme-preview-dark .preview-header {
    background: #303030;
}

.theme-preview-dark .preview-card {
    background: #303030;
}

.theme-preview-light {
    background: #fff;
}

.theme-preview-light .preview-header {
    background: #ecf0f1;
}

.theme-preview-light .preview-card {
    background: #ecf0f1;
}

.theme-preview-glass {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #6B8DD6 100%);
}

.theme-preview-glass .preview-header {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.theme-preview-glass .preview-card {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.theme-label {
    font-weight: 600;
    color: var(--text-main);
}

.theme-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Utility Classes */
.card-container {
    max-width: 800px;
    margin: 0 auto 1.5rem;
}

.card-title {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.card-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.card-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.form-section {
    margin: 2rem 0;
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.error-text {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* 
   --------------------------------------------------------------------------
   Migrated Styles from layout.blade.php
   --------------------------------------------------------------------------
*/

/* Panel Header (Full Width) */
.panel-header {
    height: var(--header-height);
    width: 100%;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

/* Sidebar Adjustment */
.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: calc(100vh - var(--header-height));
    top: var(--header-height);
    left: 0;
    z-index: 90;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-brand);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand {
    font-weight: 700;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.brand img {
    height: 32px;
    border-radius: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--text-brand);
}

/* Main Content Adjustment */
.main-content {
    flex: 1;
    margin-left: 260px;
    margin-top: var(--header-height);
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Button overrides or extensions if needed */
.btn {
    color: var(--text-main);
}

.btn-primary {
    color: white;
    /* Primary buttons keep white text usually */
}

/* Card extensions */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background-color 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    background-color: var(--bg-card-hover, var(--bg-card));
    border-color: var(--primary);
}

.card-icon {
    width: 40px;
    height: 40px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}

a.glass-card:hover .card-title,
a.card:hover .card-title {
    color: var(--primary);
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    line-height: 1.5;
}

.card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

/* Tables - Extended */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background-color: var(--bg-table-header);
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-editor {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.badge-user {
    background-color: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
}

/* Forms - FIXED: Removed hardcoded colors */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

input,
select {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-main);
    /* FIX: Was white */
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 50;
    color: var(--text-main);
}

.toast.show {
    transform: translateY(0);
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}