/* ========================================
   ADMIN PANEL STYLES
   ======================================== */

:root {
    --admin-bg: #0a0e1a;
    --admin-sidebar: #0f1624;
    --admin-card: #111827;
    --admin-card-hover: #1a2332;
    --admin-border: rgba(255, 255, 255, 0.06);
    --admin-primary: #4facfe;
    --admin-accent: #00f2fe;
    --admin-danger: #ef4444;
    --admin-success: #10b981;
    --admin-warning: #f59e0b;
    --admin-text: #f1f5f9;
    --admin-text-secondary: #94a3b8;
    --admin-text-muted: #64748b;
}

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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ========================================
   LOGIN PAGE
   ======================================== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(ellipse at center, rgba(79, 172, 254, 0.08), transparent 70%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 20px;
    padding: 48px 36px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--admin-text-secondary);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    color: var(--admin-text);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

.form-textarea.editor {
    min-height: 320px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.form-hint {
    font-size: 12px;
    color: var(--admin-text-muted);
    margin-top: 6px;
}

.btn-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    background: linear-gradient(135deg, var(--admin-primary), var(--admin-accent));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79, 172, 254, 0.3);
}

.btn-admin.full { width: 100%; }

.btn-admin.secondary {
    background: var(--admin-card-hover);
    color: var(--admin-text);
}

.btn-admin.secondary:hover {
    background: #243245;
    box-shadow: none;
}

.btn-admin.danger {
    background: var(--admin-danger);
}

.btn-admin.danger:hover {
    background: #dc2626;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

.btn-admin.ghost {
    background: transparent;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
}

.btn-admin.ghost:hover {
    background: var(--admin-card-hover);
    box-shadow: none;
}

.btn-admin.sm {
    padding: 7px 14px;
    font-size: 12px;
}

.error-msg {
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.error-msg.active { display: block; }

.success-msg {
    padding: 10px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    color: #6ee7b7;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.success-msg.active { display: block; }

/* ========================================
   ADMIN LAYOUT
   ======================================== */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--admin-sidebar);
    border-right: 1px solid var(--admin-border);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px 24px;
    border-bottom: 1px solid var(--admin-border);
    margin-bottom: 20px;
}

.admin-logo svg {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.brand-logo.admin-brand {
    width: 110px;
    height: 44px;
    flex-shrink: 0;
}

.admin-logo-text {
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--admin-accent), var(--admin-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-logo-text small {
    display: block;
    font-size: 10px;
    color: var(--admin-text-muted);
    letter-spacing: 2px;
    -webkit-text-fill-color: var(--admin-text-muted);
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-nav-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    padding: 16px 12px 8px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--admin-text-secondary);
    transition: all 0.2s ease;
}

.admin-nav a:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--admin-text);
}

.admin-nav a.active {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.15), rgba(0, 242, 254, 0.08));
    color: var(--admin-primary);
    font-weight: 600;
}

.admin-nav a i {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.admin-sidebar-footer {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
}

.admin-main {
    padding: 32px 40px;
    overflow-x: hidden;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-header h1 {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 4px;
}

.admin-header .subtitle {
    font-size: 13px;
    color: var(--admin-text-secondary);
}

.admin-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========================================
   DASHBOARD STATS
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card-admin {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    padding: 24px;
    transition: all 0.3s ease;
}

.stat-card-admin:hover {
    border-color: rgba(79, 172, 254, 0.2);
    transform: translateY(-2px);
}

.stat-card-admin .icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(79, 172, 254, 0.1);
    color: var(--admin-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 16px;
}

.stat-card-admin .value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card-admin .label {
    font-size: 13px;
    color: var(--admin-text-secondary);
}

/* ========================================
   DATA TABLE
   ======================================== */
.data-table-wrap {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: rgba(255, 255, 255, 0.02);
}

.data-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--admin-text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--admin-border);
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .title-cell {
    font-weight: 600;
    color: var(--admin-text);
}

.data-table .title-cell small {
    display: block;
    font-size: 12px;
    color: var(--admin-text-muted);
    font-weight: 400;
    margin-top: 4px;
}

.cell-tag {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(79, 172, 254, 0.1);
    color: var(--admin-primary);
    font-size: 11px;
    font-weight: 600;
    border-radius: 50px;
}

.row-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--admin-border);
    color: var(--admin-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(79, 172, 254, 0.1);
    color: var(--admin-primary);
    border-color: rgba(79, 172, 254, 0.3);
}

.icon-btn.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--admin-danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ========================================
   FORM LAYOUT
   ======================================== */
.form-container {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    padding: 32px;
    max-width: 960px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--admin-border);
    margin-top: 28px;
}

/* ========================================
   NOTIFICATION / TOAST
   ======================================== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 14px 20px;
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-left: 4px solid var(--admin-primary);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    color: var(--admin-text);
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(calc(100% + 40px));
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-left-color: var(--admin-success); }
.toast.error { border-left-color: var(--admin-danger); }
.toast.warning { border-left-color: var(--admin-warning); }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-backdrop.active { display: flex; }

.modal {
    background: var(--admin-card);
    border: 1px solid var(--admin-border);
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    padding: 28px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.modal p {
    font-size: 14px;
    color: var(--admin-text-secondary);
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Tag input */
.tag-input-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: var(--admin-bg);
    border: 1px solid var(--admin-border);
    border-radius: 10px;
    min-height: 44px;
    align-items: center;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(79, 172, 254, 0.12);
    color: var(--admin-primary);
    font-size: 12px;
    border-radius: 50px;
}

.tag-chip button {
    background: none;
    border: none;
    color: var(--admin-primary);
    cursor: pointer;
    font-size: 10px;
    opacity: 0.6;
}

.tag-chip button:hover { opacity: 1; }

.tag-input {
    flex: 1;
    min-width: 120px;
    background: transparent;
    border: none;
    color: var(--admin-text);
    padding: 4px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .admin-sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--admin-border);
    }
    .admin-main {
        padding: 24px 20px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .data-table {
        font-size: 13px;
    }
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
    .admin-sidebar-footer {
        position: static;
        margin-top: 20px;
    }
}
