/* ============================================================
   ForWardAI.Sites.Template — admin.css
   Internal admin panel styles. No MudBlazor dependency.
   ============================================================ */

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

/* ─── Shell layout ─────────────────────────────────────────── */

.admin-shell {
    display: flex;
    min-height: 100vh;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: #1a1a2e;
    background: #f4f6f9;
}

/* ─── Sidebar ───────────────────────────────────────────────── */

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: #1a1a2e;
    color: #ccc;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.admin-sidebar-header {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 1.25rem 1.25rem 0.5rem;
}

.admin-logo {
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.admin-label {
    font-size: 0.68rem;
    color: #778;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.admin-site-name {
    padding: 0.25rem 1.25rem 1rem;
    font-size: 0.8rem;
    color: #aab;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-nav {
    list-style: none;
    flex: 1;
    padding: 0.25rem 0;
}

.admin-nav li { }

.admin-nav-link {
    display: block;
    padding: 0.6rem 1.25rem;
    color: #b0b8cc;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.admin-nav-link:hover,
.admin-nav-link.active {
    background: rgba(255,255,255,0.07);
    color: #fff;
    border-left-color: #5b8dee;
}

.admin-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-view-site {
    font-size: 0.8rem;
    color: #778;
    text-decoration: none;
    transition: color 0.15s;
}

.admin-view-site:hover { color: #aab; }

.admin-logout {
    font-size: 0.8rem;
    color: #e06c6c;
    text-decoration: none;
    transition: color 0.15s;
}

.admin-logout:hover { color: #f08080; }

/* ─── Main area ─────────────────────────────────────────────── */

.admin-main {
    flex: 1;
    overflow-y: auto;
}

.admin-content {
    max-width: 860px;
    padding: 2rem 2.5rem;
}

/* ─── Page header ───────────────────────────────────────────── */

.admin-page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.35rem;
}

.admin-page-subtitle {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 2rem;
}

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

.admin-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    margin-bottom: 1.5rem;
}

.admin-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #555;
    margin-bottom: 1.1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1px solid #eee;
}

/* ─── Form fields ───────────────────────────────────────────── */

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.admin-form-group:last-child { margin-bottom: 0; }

.admin-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-input,
.admin-textarea,
.admin-select {
    padding: 0.55rem 0.8rem;
    border: 1.5px solid #dde2ea;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #1a1a2e;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.admin-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.admin-input:focus,
.admin-textarea:focus,
.admin-select:focus {
    outline: none;
    border-color: #5b8dee;
    box-shadow: 0 0 0 3px rgba(91,141,238,0.15);
}

.admin-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%23555' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.admin-hint {
    font-size: 0.75rem;
    color: #888;
    margin-top: 0.1rem;
}

/* ─── Checkbox / Toggle ─────────────────────────────────────── */

.admin-check-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.admin-check-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #5b8dee;
}

.admin-check-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
}

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

.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
}

.admin-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.admin-btn:active { transform: translateY(0); }
.admin-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.admin-btn-primary {
    background: #5b8dee;
    color: #fff;
}

.admin-btn-success {
    background: #27ae60;
    color: #fff;
}

.admin-btn-danger {
    background: #e74c3c;
    color: #fff;
}

.admin-btn-secondary {
    background: #edf0f5;
    color: #444;
}

.admin-btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.btn-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

/* ─── Status messages ───────────────────────────────────────── */

.admin-alert {
    padding: 0.65rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.admin-alert-success {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    color: #166534;
}

.admin-alert-error {
    background: #fef2f2;
    border: 1.5px solid #fca5a5;
    color: #991b1b;
}

.admin-alert-info {
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    color: #1d4ed8;
}

/* ─── List items ────────────────────────────────────────────── */

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.admin-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8f9fc;
    border-radius: 8px;
    border: 1px solid #e8ecf2;
}

.admin-list-item-text {
    flex: 1;
    font-size: 0.875rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-list-item-meta {
    font-size: 0.75rem;
    color: #888;
}

.admin-list-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ─── Inline edit form ──────────────────────────────────────── */

.admin-inline-form {
    background: #f0f4ff;
    border: 1.5px solid #c7d7f7;
    border-radius: 8px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
}

.admin-inline-form .admin-form-group { margin-bottom: 0.75rem; }

.admin-inline-form-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #3a5aa0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.85rem;
}

/* ─── Section manager ───────────────────────────────────────── */

.section-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
    transition: box-shadow 0.15s;
}

.section-row:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.06); }

.section-row-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a2e;
    flex: 1;
}

.section-row-type {
    font-size: 0.72rem;
    background: #edf0f5;
    color: #556;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-row-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.reorder-btn {
    background: none;
    border: 1px solid #dde2ea;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #666;
    transition: background 0.12s;
}

.reorder-btn:hover { background: #f0f0f0; }
.reorder-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ─── Image upload ──────────────────────────────────────────── */

.image-upload-field { }

.image-preview {
    margin-bottom: 0.6rem;
    position: relative;
    display: inline-block;
}

.image-preview img {
    max-height: 120px;
    border-radius: 6px;
    border: 1px solid #dde2ea;
    display: block;
}

.btn-clear {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: #e74c3c;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.btn-clear:hover { text-decoration: underline; }

.upload-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.upload-row .admin-input {
    flex: 1;
}

.file-input-hidden {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.9rem;
    background: #edf0f5;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    white-space: nowrap;
    border: 1.5px solid #dde2ea;
    transition: background 0.15s;
}

.btn-upload:hover { background: #e0e5ef; }
.btn-upload.uploading { opacity: 0.6; cursor: wait; }

.upload-error {
    font-size: 0.78rem;
    color: #e74c3c;
    margin-top: 0.3rem;
}

/* ─── Hero preview ──────────────────────────────────────────── */

.hero-preview {
    border-radius: 10px;
    overflow: hidden;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    padding: 2rem;
    text-align: center;
    margin-top: 1rem;
}

.hero-preview-inner { max-width: 500px; }

.hero-preview-headline {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.hero-preview-sub {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.88);
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
    margin-bottom: 0.85rem;
}

.hero-preview-cta {
    display: inline-block;
    background: #fff;
    color: #1a1a2e;
    padding: 0.4rem 1.1rem;
    border-radius: 5px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ─── Theme preview swatches ────────────────────────────────── */

.theme-swatches {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.1);
}

/* ─── Dashboard nav cards ───────────────────────────────────── */

.admin-nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.admin-nav-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: #1a1a2e;
    font-weight: 600;
    font-size: 0.875rem;
    transition: box-shadow 0.15s, transform 0.15s;
    text-align: center;
}

.admin-nav-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    color: #5b8dee;
}

.admin-nav-card-icon { font-size: 1.75rem; }

/* ─── Submissions table ─────────────────────────────────────── */

.submissions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.submissions-table th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
    border-bottom: 2px solid #eee;
}

.submissions-table td {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    vertical-align: top;
}

.submissions-table tr:last-child td { border-bottom: none; }
.submissions-table tr:hover td { background: #fafafa; }

.sub-message {
    max-width: 240px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: #666;
    font-size: 0.82rem;
}

.sub-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #eff6ff;
    color: #2563eb;
}

/* ─── Login page ────────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f6f9;
    font-family: system-ui, sans-serif;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.09);
}

.login-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.825rem;
    color: #888;
    margin-bottom: 1.75rem;
}

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.login-form .admin-btn-primary {
    width: 100%;
    justify-content: center;
    padding: 0.7rem;
}

/* ─── Color picker ──────────────────────────────────────────── */

.color-field {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.color-field input[type="color"] {
    width: 38px;
    height: 34px;
    border: 1.5px solid #dde2ea;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: #fff;
}

.color-field .admin-input { flex: 1; }

/* ─── Utility ───────────────────────────────────────────────── */

.mt-0 { margin-top: 0 !important; }
.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.text-muted { color: #888; font-size: 0.8rem; }
.text-center { text-align: center; }
.w-100 { width: 100%; }

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

@media (max-width: 720px) {
    .admin-sidebar {
        width: 56px;
    }
    .admin-site-name,
    .admin-nav-link span,
    .admin-sidebar-header .admin-logo,
    .admin-label,
    .admin-view-site,
    .admin-logout {
        display: none;
    }
    .admin-nav-link {
        padding: 0.8rem;
        text-align: center;
        font-size: 1rem;
    }
    .admin-content {
        padding: 1.25rem;
    }
}


/* ─── Builder Layout ───────────────────────────────────────── */

.builder-shell {
    min-height: 100vh;
    background: #f4f6f9;
    font-family: 'Inter', system-ui, sans-serif;
}

.builder-topnav {
    background: #1a1a2e;
    border-bottom: 2px solid #7c3aed;
    position: sticky;
    top: 0;
    z-index: 100;
}

.builder-topnav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.builder-brand {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 1.1rem;
    font-weight: 700;
}
.builder-brand-fw  { color: #7c3aed; }
.builder-brand-sep { color: #444; }
.builder-brand-app { color: #fff; }

.builder-nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.builder-nav-link {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.35rem 0.75rem;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
}
.builder-nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }

.builder-nav-link-primary {
    background: #7c3aed;
    color: #fff !important;
    font-weight: 600;
}
.builder-nav-link-primary:hover { background: #6d28d9 !important; }

.builder-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.builder-content { width: 100%; }

/* ─── Site Cards ───────────────────────────────────────────── */

.builder-page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 0.4rem;
}

.builder-page-subtitle {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.site-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: box-shadow 0.15s;
}
.site-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.site-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
}

.site-card-client {
    font-size: 0.85rem;
    color: #666;
}

.site-card-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    width: fit-content;
    text-transform: capitalize;
}
.status-active  { background: #dcfce7; color: #166534; }
.status-pending { background: #fef9c3; color: #854d0e; }
.status-paused  { background: #f1f5f9; color: #64748b; }

.site-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    flex-wrap: wrap;
}

.site-card-btn {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s;
    min-width: 90px;
}
.site-card-btn-live  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.site-card-btn-live:hover  { background: #dcfce7; }
.site-card-btn-admin { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.site-card-btn-admin:hover { background: #dbeafe; }

.sites-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}
.sites-empty h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: #333; }

/* ─── New Site Wizard ──────────────────────────────────────── */

.wizard-card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 2rem;
    max-width: 680px;
}

.wizard-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}
.wizard-section-title:first-child { margin-top: 0; }

.sections-toggle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    transition: background 0.12s;
}
.section-toggle:hover { background: #f8fafc; }
.section-toggle input { cursor: pointer; }
