/* ==========================================================================
   LP MEDIA - CMS Dashboard Styles (Inspired by #9488DC Logo Identity)
   ========================================================================== */

:root {
    --brand: #9488DC;
    --brand-deep: #6D5EC8;
    --brand-dark: #5445AF;
    --brand-tint: #F5F3FC;
    --brand-soft: #E9E4FA;
    --ink: #141122;
    --ink-soft: #4F4A66;
    --ink-muted: #7C7794;
    --midnight: #12101E;
    --surface: #FFFFFF;
    --border: rgba(148, 136, 220, 0.25);
    --wa: #25D366;
    --danger: #DC2626;
    --success: #16A34A;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(20, 17, 34, 0.06);
}

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

body {
    margin: 0;
    background: var(--brand-tint);
    color: var(--ink);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
}

body.lang-ar {
    font-family: 'Cairo', system-ui, -apple-system, sans-serif;
}

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

button {
    font-family: inherit;
    cursor: pointer;
}

img {
    max-width: 100%;
    display: block;
}

/* Login Screen */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(148, 136, 220, 0.25), transparent 45%),
        radial-gradient(circle at bottom left, rgba(109, 94, 200, 0.2), transparent 45%),
        var(--midnight);
}

.login-card {
    width: min(100%, 420px);
    background: var(--surface);
    border-radius: 18px;
    padding: 36px 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    border-top: 4px solid var(--brand);
}

.login-logo {
    height: 44px;
    width: auto;
    margin: 0 auto 20px;
}

.login-title {
    margin: 0 0 6px;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 800;
}

.login-sub {
    margin: 0 0 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.login-footer-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    font-size: 0.86rem;
    color: var(--brand-dark);
    font-weight: 700;
}

/* Admin Layout */
.cms-topbar {
    background: var(--midnight);
    color: #FFFFFF;
    border-bottom: 3px solid var(--brand);
    padding: 14px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.cms-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.cms-brand img {
    height: 36px;
    width: auto;
}

.cms-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(148, 136, 220, 0.2);
    border: 1px solid rgba(148, 136, 220, 0.45);
    color: #E9E4FA;
    font-size: 0.78rem;
    font-weight: 700;
}

.cms-top-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.cms-container {
    width: min(100% - 32px, 1280px);
    margin: 26px auto 60px;
}

/* Stats Strip */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
}

.stat-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-muted);
}

.stat-val {
    display: block;
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--brand-dark);
    margin-top: 2px;
}

/* Tabs */
.cms-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
    background: var(--surface);
    padding: 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.cms-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink-soft);
    transition: all 0.2s ease;
}

.cms-tab:hover {
    background: var(--brand-tint);
    color: var(--brand-dark);
}

.cms-tab.is-active {
    background: var(--brand-deep);
    color: #FFFFFF;
}

.unread-pill {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    background: var(--danger);
    color: #FFFFFF;
}

/* Panels & Cards */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.panel-title {
    margin: 0 0 6px;
    font-size: 1.2rem;
    font-weight: 800;
}

.panel-sub {
    margin: 0 0 20px;
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.alert {
    padding: 13px 16px;
    border-radius: 10px;
    margin-bottom: 18px;
    font-weight: 700;
    font-size: 0.92rem;
}

.alert-success {
    background: #ECFDF5;
    border: 1px solid #86EFAC;
    color: #166534;
}

.alert-error {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--ink);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1px solid rgba(148, 136, 220, 0.4);
    border-radius: 9px;
    background: var(--brand-tint);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.93rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    background: #FFFFFF;
    border-color: var(--brand-deep);
}

.field-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Upload Dropzone */
.dropzone {
    border: 2px dashed var(--brand);
    border-radius: 12px;
    background: var(--brand-tint);
    padding: 24px;
    text-align: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    margin-bottom: 14px;
}

.dropzone.is-dragover {
    background: var(--brand-soft);
    border-color: var(--brand-dark);
}

.dropzone input[type="file"] {
    display: block;
    margin: 12px auto 0;
    max-width: 100%;
}

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.upload-preview-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 9px;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--brand-deep);
    color: #FFFFFF;
}

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

.btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-outline {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}

.btn-outline:hover {
    border-color: var(--brand-deep);
    color: var(--brand-dark);
}

.btn-danger {
    background: #FEE2E2;
    color: #B91C1C;
    border-color: #FECACA;
}

.btn-danger:hover {
    background: #DC2626;
    color: #FFFFFF;
}

.btn-wa {
    background: #DCFCE7;
    color: #15803D;
    border-color: #86EFAC;
}

.btn-wa:hover {
    background: var(--wa);
    color: #FFFFFF;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
}

/* Slider Cards in Admin */
.slide-admin-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.slide-admin-card {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--brand-tint);
    align-items: start;
}

.slide-thumb-box {
    border-radius: 10px;
    overflow: hidden;
    background: var(--midnight);
    aspect-ratio: 16 / 9;
}

.slide-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

/* Portfolio Admin Grid */
.cat-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.cat-pill {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--brand-tint);
    font-size: 0.86rem;
    font-weight: 700;
}

.cat-pill.is-active {
    background: var(--brand-deep);
    color: #FFFFFF;
    border-color: var(--brand-deep);
}

.portfolio-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.portfolio-admin-card {
    background: var(--brand-tint);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.portfolio-admin-card.is-hidden-item {
    opacity: 0.65;
}

.portfolio-admin-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--midnight);
}

.portfolio-admin-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-tag {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    background: rgba(18, 16, 30, 0.78);
    color: #FFFFFF;
}

.portfolio-admin-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.inline-controls select,
.inline-controls input {
    padding: 6px 8px;
    border-radius: 7px;
    border: 1px solid var(--border);
    font-size: 0.82rem;
    background: #FFFFFF;
}

.inline-controls input[type="number"] {
    width: 64px;
}

.inline-controls select {
    flex: 1;
    min-width: 0;
}

/* Messages Table/Cards */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.message-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: #FFFFFF;
}

.message-card.is-unread {
    border-inline-start: 4px solid var(--brand-deep);
    background: var(--brand-tint);
}

.message-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.message-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.message-body {
    margin: 0 0 14px;
    white-space: pre-wrap;
    font-size: 0.94rem;
}

.service-edit-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    background: var(--brand-tint);
    margin-bottom: 14px;
}

.service-edit-box h4 {
    margin: 0 0 12px;
    color: var(--brand-dark);
}

.site-img-preview {
    width: 140px;
    max-height: 140px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    background: #FFFFFF;
    margin-bottom: 10px;
}

@media (max-width: 820px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid,
    .form-grid-3,
    .slide-admin-card {
        grid-template-columns: 1fr;
    }
}
