/* ===== Admin Base Styles ===== */
/* Static CSS for admin interface - theme variables set inline in base_admin.html */

/* Shared variables (non-theme) */
:root {
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);
    --text-dim: rgba(255, 255, 255, 0.35);
    --card-bg: var(--glass);
    --border: var(--glass-border);
    --green: #22c55e;
    --green-glow: rgba(34, 197, 94, 0.25);
    --red: #ef4444;
    --yellow: #eab308;
    --star: #fbbf24;
    --radius: 14px;
    --radius-sm: 10px;
    --sidebar-width: 240px;
    /* Form / overlay defaults (dark) — overridden by light theme */
    --input-bg: #1a1a24;
    --input-bg-focus: #1e1e2a;
    --input-border: #2a2a3a;
    --placeholder: #555;
    --dropdown-bg: #1e1e28;
    --modal-bg: #1a1a24;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 15% 15%, var(--bg-gradient-1) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 85%, var(--bg-gradient-2) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

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

.sidebar-logo {
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo img {
    height: 36px;
    border-radius: 8px;
}
.sidebar-logo .logo-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-logo .logo-ph {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-text));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

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

.nav-section {
    margin-bottom: 4px;
}
.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    padding: 8px 12px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 1px;
}
.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.nav-item.active {
    background: var(--sidebar-active);
    color: var(--accent-text);
}
.nav-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}
.nav-item.active svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--glass-border);
}
.dojo-name-footer {
    font-size: 11px;
    color: var(--text-dim);
    padding: 8px 12px;
    text-align: center;
    font-weight: 500;
    margin-bottom: 4px;
}
.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
    width: 100%;
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}
.logout-btn svg {
    width: 18px;
    height: 18px;
}

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

.page-header {
    padding: 24px 32px 0;
}
.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
}
.page-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

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

/* ===== Cards ===== */
.card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-glow);
}
.btn-secondary {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text);
    border-color: var(--accent);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn svg {
    width: 16px;
    height: 16px;
}

/* ===== Tables ===== */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--glass-border);
}
table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
}
table tr:hover td {
    background: var(--surface-hover);
}
table a {
    color: var(--accent-text);
    text-decoration: none;
}
table a:hover {
    text-decoration: underline;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    transition: all 0.2s ease;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--input-bg-focus);
}
.form-input::placeholder,
.form-textarea::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--placeholder);
}
.form-select,
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
.form-select option,
select option {
    background: var(--input-bg);
    color: var(--text);
}
.form-textarea,
textarea {
    min-height: 100px;
    resize: vertical;
}
.form-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* File input styling */
input[type="file"] {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font-size: 13px;
}
input[type="file"]::file-selector-button {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    padding: 8px 16px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.15s;
}
input[type="file"]::file-selector-button:hover {
    background: var(--input-bg-focus);
    border-color: var(--accent);
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}
.badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}
.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.badge-info {
    background: var(--sidebar-active);
    color: var(--accent-text);
}

/* ===== Alerts ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-text));
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-fill.success {
    background: linear-gradient(90deg, var(--green), #4ade80);
}

/* ===== Avatar ===== */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}
.avatar-ph {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-text));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}
.avatar-sm { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ===== Stars ===== */
.stars {
    display: flex;
    gap: 2px;
}
.star {
    color: var(--text-dim);
    font-size: 16px;
}
.star.filled {
    color: var(--star);
}

/* ===== Dropdown Menu ===== */
.dropdown {
    position: relative;
}
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--dropdown-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}
.dropdown-menu.show {
    display: block;
}
.dropdown-item {
    display: block;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.1s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
}
.dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}
.dropdown-item.danger {
    color: #f87171;
}
.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}
.dropdown-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 4px 0;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}
.modal-overlay.show {
    display: flex;
}
.modal {
    background: var(--modal-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}
.modal-lg { max-width: 640px; }
.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-dim);
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text);
}
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 600;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.toast.show {
    opacity: 1;
}

/* ===== Utility Classes ===== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ===== Grid ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===== Mobile Responsive Admin ===== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    /* Hide sidebar on mobile by default */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }

    /* Mobile overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    .sidebar-overlay.show {
        display: block;
    }

    /* Main content takes full width on mobile */
    .main-content {
        margin-left: 0;
    }

    /* Mobile header with menu toggle */
    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        background: var(--glass);
        border-bottom: 1px solid var(--glass-border);
        position: sticky;
        top: 0;
        z-index: 50;
    }
    .mobile-header .menu-toggle {
        background: var(--surface);
        border: 1px solid var(--glass-border);
        color: var(--text);
        width: 40px;
        height: 40px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
    }
    .mobile-header .mobile-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--text);
        flex: 1;
    }

    /* Adjust page padding */
    .page-header {
        padding: 16px;
    }
    .page-body {
        padding: 16px;
    }
    .page-title {
        font-size: 22px;
    }

    /* Cards more compact on mobile */
    .card {
        padding: 16px;
        margin-bottom: 12px;
    }

    /* Forms full width */
    .form-group {
        margin-bottom: 16px;
    }

    /* Tables scroll horizontally */
    .table-wrap {
        margin: 0 -16px;
        padding: 0 16px;
    }
    table {
        min-width: 600px;
    }

    /* Buttons stack on mobile */
    .page-actions {
        flex-wrap: wrap;
    }
    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* Modal full screen on mobile */
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .modal-overlay {
        align-items: flex-end;
    }
}

/* Show mobile header only on mobile */
@media (min-width: 769px) {
    .mobile-header {
        display: none;
    }
    .sidebar-overlay {
        display: none !important;
    }
}
