/* ═══════════════════════════════════════════════════════════════════════
   Pattupetti Admin Styles
   Clean, utilitarian design — dark header, light content.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --text: #2d3436;
    --text-muted: #636e72;
    --primary: #6c5ce7;
    --primary-hover: #5a4bd1;
    --danger: #d63031;
    --danger-hover: #b71c1c;
    --secondary: #dfe6e9;
    --secondary-hover: #b2bec3;
    --border: #dfe6e9;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 8px;
    --header-bg: #2d3436;
    --header-text: #dfe6e9;
    --success: #00b894;
    --error: #d63031;
    --info: #0984e3;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Login Page ──────────────────────────────────────────────────────────── */

body.admin-login {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
}

.login-box {
    background: var(--surface);
    padding: 48px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-box h2 {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 24px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.login-form label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.login-form input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.login-form button {
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-form button:hover {
    background: var(--primary-hover);
}

/* ── Header & Navigation ─────────────────────────────────────────────────── */

.admin-header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.admin-header h1 {
    font-size: 20px;
    font-weight: 700;
}

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

.admin-header nav a {
    color: #b2bec3;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.admin-header nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.admin-header nav a.active {
    color: #fff;
    background: var(--primary);
}

.admin-header nav a.logout-link {
    margin-left: 16px;
    color: #fab1a0;
}

/* ── Main Content ────────────────────────────────────────────────────────── */

.admin-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 24px;
}

.admin-main h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: var(--text);
}

.admin-main h3 {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Stats Grid (Dashboard) ──────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Quick Actions ───────────────────────────────────────────────────────── */

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

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

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

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-section {
    background: var(--surface);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form input[type="text"],
.inline-form select {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    flex: 1;
    min-width: 150px;
}

.inline-form input:focus,
.inline-form select:focus {
    outline: none;
    border-color: var(--primary);
}

.edit-playlist-form {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 0 0 var(--radius) var(--radius);
    flex-wrap: wrap;
}

.edit-playlist-form input[type="text"] {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    flex: 2;
}

.edit-playlist-form select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    flex: 1;
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #e6fff5;
    color: #006644;
    border: 1px solid #b7ebd5;
}

.alert-error {
    background: #ffe6e6;
    color: #8b0000;
    border: 1px solid #f5c6c6;
}

.alert-info {
    background: #e6f0ff;
    color: #003d8b;
    border: 1px solid #c6ddf5;
}

.alert code {
    background: rgba(0,0,0,0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

/* ── Data Table ──────────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

.data-table tr:hover td {
    background: #f8f9fa;
}

.data-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.list-section {
    margin-bottom: 32px;
}

/* ── Playlist Cards ──────────────────────────────────────────────────────── */

.playlist-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.playlist-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.playlist-info strong {
    font-size: 16px;
}

.badge {
    background: var(--primary);
    color: #fff;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.profile-tag {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

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

/* ── Video Manager (inside expanded playlist) ────────────────────────────── */

.video-manager {
    padding: 20px;
    border-top: 2px solid var(--border);
    background: #fafbfc;
}

.video-manager h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    margin-top: 16px;
}

.video-manager h4:first-child {
    margin-top: 0;
}

.add-video-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.add-video-form input[type="text"] {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

.add-video-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.add-video-form .btn {
    height: 42px;
}

/* ── Empty State ─────────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-style: italic;
}

/* ── External Link ───────────────────────────────────────────────────────── */

.external-link {
    color: var(--info);
    text-decoration: none;
    font-family: monospace;
    font-size: 13px;
}

.external-link:hover {
    text-decoration: underline;
}

/* ── Edit inline ─────────────────────────────────────────────────────────── */

.edit-inline {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .admin-header {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 8px;
    }

    .admin-header nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .admin-main {
        padding: 16px 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .playlist-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
