/**
 * Mobile-First Admin Panel Stylesheet
 * Optimized specifically for iOS / Android mobile browsers and tablets/desktops
 */

:root {
    --adm-bg: #0d1117;
    --adm-surface: #161b22;
    --adm-surface-elevated: #21262d;
    --adm-border: #30363d;
    --adm-primary: #d4af37;
    --adm-primary-hover: #e5b95c;
    --adm-accent-green: #238636;
    --adm-accent-green-hover: #2ea043;
    --adm-danger: #da3633;
    --adm-text-main: #f0f6fc;
    --adm-text-muted: #8b949e;
    --adm-bottom-bar-height: 64px;
    --adm-radius: 12px;
}

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

body.admin-body {
    background-color: var(--adm-bg);
    color: var(--adm-text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding-bottom: calc(var(--adm-bottom-bar-height) + 20px);
    -webkit-tap-highlight-color: transparent;
}

@media (min-width: 992px) {
    body.admin-body {
        padding-bottom: 30px;
        display: flex;
    }
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* Admin Top Bar */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 500;
    height: 60px;
    background: rgba(22, 27, 34, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.admin-topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--adm-primary);
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--adm-surface-elevated);
    border: 1px solid var(--adm-border);
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--adm-text-main);
}

.topbar-btn:hover {
    border-color: var(--adm-primary);
}

/* Admin Container & Layout */
.admin-wrapper {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

@media (min-width: 992px) {
    .admin-desktop-sidebar {
        width: 240px;
        flex-shrink: 0;
        background: var(--adm-surface);
        border-right: 1px solid var(--adm-border);
        min-height: 100vh;
        padding: 24px 16px;
        display: flex;
        flex-direction: column;
    }
    
    .admin-main-content-col {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 991px) {
    .admin-desktop-sidebar {
        display: none;
    }
}

/* Mobile Bottom Thumb Navigation */
.admin-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--adm-bottom-bar-height);
    background: rgba(22, 27, 34, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--adm-border);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (min-width: 992px) {
    .admin-bottom-nav {
        display: none;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--adm-text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 52px;
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

.bottom-nav-item.active, .bottom-nav-item:active {
    color: var(--adm-primary);
}

/* Sidebar Navigation (Desktop) */
.sidebar-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--adm-text-muted);
    font-weight: 500;
    font-size: 0.92rem;
}

.sidebar-nav-item a:hover {
    background: var(--adm-surface-elevated);
    color: var(--adm-text-main);
}

.sidebar-nav-item a.active {
    background: rgba(212, 175, 55, 0.12);
    color: var(--adm-primary);
    font-weight: 600;
}

/* Quick Master Toggle Card (Blog ON/OFF) */
.master-toggle-card {
    background: linear-gradient(135deg, #1b212c 0%, #161b22 100%);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 18px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.toggle-card-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.toggle-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(212, 175, 55, 0.15);
    color: var(--adm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toggle-title {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    display: block;
}

.toggle-status-text {
    font-size: 0.8rem;
    color: var(--adm-text-muted);
}

/* Big Touch-Friendly Switch */
.switch-ui {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    flex-shrink: 0;
}

.switch-ui input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-knob {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #30363d;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 34px;
}

.slider-knob:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
}

input:checked + .slider-knob {
    background-color: var(--adm-accent-green);
}

input:checked + .slider-knob:before {
    transform: translateX(26px);
}

/* Dashboard Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (min-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

.stat-box {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--adm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Mobile Action Buttons (Thumb Friendly) */
.quick-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}

@media (min-width: 600px) {
    .quick-actions-bar {
        grid-template-columns: repeat(4, 1fr);
    }
}

.quick-act-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--adm-text-main);
    text-align: center;
    min-height: 48px;
}

.quick-act-btn:active {
    background: var(--adm-surface-elevated);
    border-color: var(--adm-primary);
}

/* Mobile-First Item Cards (Tracks, Poems, Scripts, Posts) */
.admin-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 18px;
    margin-bottom: 14px;
    position: relative;
}

.admin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.admin-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
}

.admin-card-meta {
    font-size: 0.8rem;
    color: var(--adm-text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.admin-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--adm-surface-elevated);
    border: 1px solid var(--adm-border);
    color: var(--adm-primary);
}

.admin-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--adm-border);
    padding-top: 12px;
    margin-top: 12px;
}

.btn-sm-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--adm-surface-elevated);
    border: 1px solid var(--adm-border);
    color: var(--adm-text-main);
    min-height: 38px;
}

.btn-sm-action.btn-delete {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
    margin-left: auto;
}

.btn-sm-action:hover {
    border-color: var(--adm-primary);
}

/* Mobile Forms */
.admin-form-group {
    margin-bottom: 18px;
}

.admin-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--adm-text-main);
    margin-bottom: 6px;
}

.admin-input, .admin-textarea, .admin-select {
    width: 100%;
    background: var(--adm-surface-elevated);
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: 12px 14px;
    color: #ffffff;
    font-size: 0.95rem;
    min-height: 48px;
}

.admin-input:focus, .admin-textarea:focus, .admin-select:focus {
    outline: none;
    border-color: var(--adm-primary);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.admin-textarea {
    min-height: 120px;
    line-height: 1.5;
}

.admin-help-text {
    font-size: 0.78rem;
    color: var(--adm-text-muted);
    margin-top: 5px;
}

.btn-adm-save {
    width: 100%;
    background: var(--adm-primary);
    color: #0c0e12;
    font-weight: 700;
    font-size: 1rem;
    padding: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-adm-save:hover {
    background: var(--adm-primary-hover);
}

/* Login Page Styling */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #090c10;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    padding: 32px 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.login-logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--adm-primary);
    text-align: center;
    margin-bottom: 4px;
}

.login-sub {
    font-size: 0.84rem;
    color: var(--adm-text-muted);
    text-align: center;
    margin-bottom: 28px;
}

/* Notifications */
.adm-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.adm-alert.success {
    background: rgba(35, 134, 54, 0.15);
    border: 1px solid rgba(35, 134, 54, 0.4);
    color: #3fb950;
}

.adm-alert.error {
    background: rgba(218, 54, 51, 0.15);
    border: 1px solid rgba(218, 54, 51, 0.4);
    color: #f85149;
}
