/* ============================================================
   Landing Page Manager — Admin Panel CSS
   ============================================================ */

:root {
    --color-bg:        #f0f2f5;
    --color-sidebar:   #1a1d23;
    --color-sidebar-hover: #2a2f3a;
    --color-sidebar-active: #3b82f6;
    --color-white:     #ffffff;
    --color-text:      #111827;
    --color-text-muted:#6b7280;
    --color-border:    #e5e7eb;
    --color-primary:   #3b82f6;
    --color-primary-dark: #2563eb;
    --color-danger:    #ef4444;
    --color-danger-dark: #dc2626;
    --color-success:   #22c55e;
    --color-warning:   #f59e0b;
    --color-purple:    #8b5cf6;
    --radius:          10px;
    --sidebar-w:       240px;
    --topbar-h:        60px;
    --shadow:          0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:       0 4px 12px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Layout
   ============================================================ */
.admin-body {
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.admin-sidebar {
    width: var(--sidebar-w);
    background: var(--color-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}
.sidebar-brand svg { width: 22px; height: 22px; flex-shrink: 0; }

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.65);
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
}
.sidebar-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link:hover, .sidebar-link.active {
    background: var(--color-sidebar-hover);
    color: #fff;
    text-decoration: none;
}
.sidebar-link.active {
    background: var(--color-sidebar-active);
    color: #fff;
}

.sidebar-footer {
    padding: 12px 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-user-avatar {
    width: 32px; height: 32px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; color: #fff;
    flex-shrink: 0;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-username { color: #fff; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-role { color: rgba(255,255,255,0.45); font-size: 0.75rem; text-transform: capitalize; }
.sidebar-logout {
    color: rgba(255,255,255,0.45); display: flex; align-items: center;
    padding: 6px; border-radius: 6px; transition: color 0.15s, background 0.15s;
    text-decoration: none;
}
.sidebar-logout svg { width: 18px; height: 18px; }
.sidebar-logout:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }

/* ============================================================
   Main content
   ============================================================ */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: var(--topbar-h);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: var(--shadow);
}
.admin-page-title { font-size: 1.1rem; font-weight: 700; color: var(--color-text); }

.admin-content {
    padding: 24px 28px;
    flex: 1;
    max-width: 1200px;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}
.card--narrow { max-width: 560px; }
.card--sticky .card-body { position: sticky; top: calc(var(--topbar-h) + 20px); }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 0.95rem; font-weight: 700; }
.card-link { font-size: 0.85rem; color: var(--color-primary); }
.card-body { padding: 20px; }
.card-body--border { border-top: 1px solid var(--color-border); padding: 16px 20px; }
.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    display: flex; flex-direction: column; gap: 8px;
}

/* ============================================================
   Stats grid (dashboard)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon--blue   { background: #dbeafe; color: #2563eb; }
.stat-icon--green  { background: #dcfce7; color: #16a34a; }
.stat-icon--orange { background: #ffedd5; color: #ea580c; }
.stat-icon--purple { background: #ede9fe; color: #7c3aed; }
.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--color-text); }
.stat-label { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 3px; }

/* ============================================================
   Data table
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th {
    text-align: left; padding: 11px 16px;
    background: #f9fafb; color: var(--color-text-muted);
    font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f9fafb; }
.data-table tr.row-inactive td { opacity: 0.55; }

.actions { display: flex; gap: 6px; }
.slug-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--color-primary); }
.slug-link svg { width: 12px; height: 12px; }
.page-url-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; word-break: break-all; color: var(--color-primary); }
.page-url-link svg { width: 12px; height: 12px; flex-shrink: 0; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge--active   { background: #dcfce7; color: #16a34a; }
.badge--inactive { background: #f3f4f6; color: #6b7280; }
.badge--admin    { background: #ede9fe; color: #7c3aed; }
.badge--editor   { background: #dbeafe; color: #2563eb; }
.badge--clickable { cursor: pointer; border: none; font-family: inherit; transition: opacity 0.15s; }
.badge--clickable:hover { opacity: 0.75; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 9px 18px;
    border-radius: 8px; border: none;
    font-size: 0.88rem; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn-primary  { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }
.btn-secondary { background: #f3f4f6; color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: #e5e7eb; color: var(--color-text); }
.btn-danger   { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: var(--color-danger-dark); color: #fff; }
.btn-ghost    { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: #f3f4f6; color: var(--color-text); }
.btn-sm       { padding: 5px 12px; font-size: 0.82rem; }
.btn-full     { width: 100%; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}
.flash--success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash--error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash--info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block; margin-bottom: 6px;
    font-size: 0.85rem; font-weight: 600; color: var(--color-text);
}
.required { color: var(--color-danger); }
.form-control {
    width: 100%; padding: 9px 13px;
    border: 1.5px solid var(--color-border);
    border-radius: 7px; font-size: 0.9rem;
    background: var(--color-white); color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-control--select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; cursor: pointer; }
.form-hint { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }

/* Password toggle */
.input-password-wrap { position: relative; }
.input-password-wrap .form-control { padding-right: 44px; }
.toggle-password {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; padding: 4px;
    color: var(--color-text-muted); display: flex;
}
.toggle-password svg { width: 18px; height: 18px; }
.toggle-password:hover { color: var(--color-text); }

/* Toggle / checkbox switch */
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.9rem; }
.toggle-label input[type="checkbox"] { display: none; }
.toggle-switch {
    width: 42px; height: 24px;
    background: #d1d5db; border-radius: 12px;
    position: relative; transition: background 0.2s;
    flex-shrink: 0;
}
.toggle-switch::after {
    content: ''; position: absolute;
    width: 18px; height: 18px;
    background: #fff; border-radius: 50%;
    top: 3px; left: 3px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-label input:checked + .toggle-switch { background: var(--color-primary); }
.toggle-label input:checked + .toggle-switch::after { transform: translateX(18px); }

.check-inline { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; cursor: pointer; white-space: nowrap; }
.check-inline input { width: 15px; height: 15px; cursor: pointer; }

.divider { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }
.section-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: 12px; }

/* ============================================================
   Color picker
   ============================================================ */
.color-input-wrap { display: flex; gap: 10px; align-items: center; }
.color-swatch {
    width: 40px; height: 40px;
    border: 1.5px solid var(--color-border);
    border-radius: 7px; padding: 2px;
    cursor: pointer; background: none;
    flex-shrink: 0;
}
.color-text { flex: 1; font-family: monospace; }

/* ============================================================
   File upload
   ============================================================ */
.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: 8px;
    padding: 16px;
    background: #f9fafb;
    transition: border-color 0.15s;
}
.upload-area.drag-over { border-color: var(--color-primary); background: #eff6ff; }
.upload-preview {
    margin-bottom: 12px;
    display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.upload-preview img {
    max-width: 100%; max-height: 140px;
    border-radius: 6px; object-fit: contain;
    border: 1px solid var(--color-border);
}
.upload-remove { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--color-danger); cursor: pointer; }
.upload-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--color-white); border: 1.5px solid var(--color-border);
    border-radius: 7px; padding: 7px 14px;
    font-size: 0.85rem; font-weight: 500; cursor: pointer;
    color: var(--color-text); transition: background 0.15s, border-color 0.15s;
}
.upload-btn svg { width: 16px; height: 16px; }
.upload-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.upload-input { display: none; }

/* ============================================================
   Repeater rows (buttons & social links)
   ============================================================ */
.repeater-row {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px;
    background: #f9fafb;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: box-shadow 0.15s;
}
.repeater-row.dragging { box-shadow: 0 4px 16px rgba(0,0,0,0.15); opacity: 0.9; }
.repeater-handle {
    cursor: grab; color: #9ca3af; padding: 8px 4px 0;
    font-size: 1.1rem; line-height: 1; flex-shrink: 0;
    user-select: none;
}
.repeater-fields { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.repeater-fields .form-control { flex: 1; min-width: 140px; }
.btn-remove-row {
    background: none; border: none; cursor: pointer;
    color: #9ca3af; padding: 6px; border-radius: 6px;
    font-size: 0.9rem; line-height: 1; flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.btn-remove-row:hover { color: var(--color-danger); background: #fee2e2; }

.empty-buttons-msg { color: var(--color-text-muted); font-size: 0.85rem; padding: 8px 0; }

/* ============================================================
   Page form layout (2-column)
   ============================================================ */
.form-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.form-col { display: flex; flex-direction: column; gap: 0; }

/* ============================================================
   Slug input
   ============================================================ */
.slug-input-wrap { display: flex; align-items: center; border: 1.5px solid var(--color-border); border-radius: 7px; overflow: hidden; }
.slug-input-wrap:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.slug-prefix { padding: 9px 10px 9px 13px; background: #f3f4f6; color: var(--color-text-muted); font-size: 0.82rem; white-space: nowrap; border-right: 1px solid var(--color-border); }
.slug-input { border: none; border-radius: 0; box-shadow: none !important; flex: 1; }
.slug-input:focus { box-shadow: none !important; border: none; outline: none; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 48px 24px; text-align: center; color: var(--color-text-muted);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }

/* ============================================================
   User cell
   ============================================================ */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}

/* ============================================================
   Login page
   ============================================================ */
.login-body { background: var(--color-bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card { background: var(--color-white); border-radius: 16px; padding: 40px 36px; box-shadow: var(--shadow-md); }
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { width: 44px; height: 44px; color: var(--color-primary); margin: 0 auto 14px; }
.login-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; }
.login-subtitle { color: var(--color-text-muted); font-size: 0.9rem; }
.login-form { display: flex; flex-direction: column; gap: 4px; }
.login-form .form-group { margin-bottom: 16px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .card--sticky .card-body { position: static; }
}
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-content { padding: 16px; }
    .admin-topbar { padding: 0 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .data-table { font-size: 0.82rem; }
    .data-table th, .data-table td { padding: 10px 12px; }
}
