﻿/* === Casamadre – Theme ===================================================== */
:root {
    /* Brand */
    --brand-50: #e6fbf4;
    --brand-100: #c9f7e8;
    --brand-200: #9ff0d7;
    --brand-300: #76e9c6;
    --brand-400: #4fe2b5;
    --brand-500: #26d9a1;
    --brand-600: #00d084;
    --brand-700: #00a66b;
    --brand-800: #007e51;
    --brand-900: #005a3a;
    /* Neutrals */
    --bg: #f7f9fb;
    --panel: #ffffff;
    --muted: #6b7280;
    --text: #0f172a;
    --border: #e5e7eb;
    /* Elevation */
    --shadow: 0 10px 20px rgba(2,8,20,.06), 0 2px 6px rgba(2,8,20,.04);
    --ring: 0 0 0 3px rgba(0,208,132,.25);
    /* Radius & spacing */
    --r: 16px;
    --r-sm: 10px;
    --gap: 16px;
    --gap-sm: 10px;
    --container: 1200px;
}

/* Base */
* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--brand-700);
    text-decoration: none
}

    a:hover {
        text-decoration: underline
    }

img {
    max-width: 100%;
    display: block
}

/* Layout */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px
}

.main {
    padding: 24px 0 48px
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(180%) blur(12px);
    background: rgba(255,255,255,.85);
    border-bottom: 1px solid var(--border);
}

    .navbar .wrap {
        display: flex;
        align-items: center;
        gap: 16px;
        height: 64px
    }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

    .brand img {
        height: 42px;
        width: auto
    }

.menu {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center
}

    .menu a {
        padding: 10px 12px;
        border-radius: 10px;
        color: #111827
    }

        .menu a:hover {
            background: var(--brand-50)
        }

    .menu .sep {
        width: 1px;
        height: 28px;
        background: var(--border);
        margin: 0 8px
    }

.burger {
    display: none;
    margin-left: auto;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    height: 40px;
    width: 40px
}

@media (max-width:900px) {
    .menu {
        display: none
    }

        .menu.open {
            display: flex;
            position: absolute;
            top: 64px;
            left: 0;
            right: 0;
            padding: 8px 20px 16px;
            background: #fff;
            border-bottom: 1px solid var(--border)
        }

    .burger {
        display: inline-flex;
        align-items: center;
        justify-content: center
    }
}

/* Footer */
.footer {
    padding: 28px 0;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: #fff
}

/* Headings */
h1 {
    font-size: 32px;
    line-height: 1.2;
    margin: 0 0 12px
}

h2 {
    font-size: 24px;
    line-height: 1.25;
    margin: 20px 0 10px
}

h3 {
    font-size: 18px;
    line-height: 1.3;
    margin: 14px 0 8px
}

/* Cards */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow);
}

    .card.pad {
        padding: 16px
    }

/* Buttons */
.btn {
    --bg: #111827;
    --fg: #fff;
    --bd: transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--bd);
    background: var(--bg);
    color: var(--fg);
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .04s ease, background .15s ease, box-shadow .15s ease;
}

    .btn:active {
        transform: translateY(1px)
    }

    .btn:focus {
        outline: none;
        box-shadow: var(--ring)
    }

    .btn:hover {
        filter: brightness(0.98)
    }

.btn-sm {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px
}

.btn-block {
    width: 100%;
    justify-content: center
}

.btn-brand {
    --bg: var(--brand-600)
}

.btn-outline {
    --bg: #fff;
    --fg: #111827;
    --bd: var(--border)
}

.btn-danger {
    --bg: #ef4444
}

.btn-ghost {
    --bg: transparent;
    --fg: #111827;
    --bd: transparent
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid var(--border);
    background: #fff;
    color: #111827
}

    .badge.brand {
        background: var(--brand-50);
        border-color: var(--brand-200);
        color: var(--brand-800)
    }

    .badge.muted {
        background: #f3f4f6;
        border-color: #e5e7eb;
        color: #4b5563
    }

/* Grid utilities */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap)
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: var(--gap)
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: var(--gap)
}

@media (max-width:900px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr
    }
}

/* Forms */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px
}

    .form-row.inline {
        flex-direction: row;
        gap: 12px;
        align-items: flex-end
    }

label {
    font-weight: 600;
    font-size: 14px;
    color: #374151
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
    background: #fff;
    color: #111827;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
    transition: box-shadow .15s ease, border-color .15s ease;
}

    input:focus, select:focus, textarea:focus {
        border-color: var(--brand-400);
        box-shadow: var(--ring)
    }

    input[readonly], select[readonly] {
        background: #f9fafb
    }

/* Validation (server + jQuery Validate) */
.text-danger, .field-validation-error {
    color: #dc2626;
    font-size: 13px
}

input.input-validation-error, select.input-validation-error, textarea.input-validation-error {
    border-color: #dc2626 !important;
    background: #fff5f5;
}

.validation-summary-errors {
    border: 1px solid #dc2626;
    background: #fff5f5;
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 12px
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px
}

    .table th, .table td {
        text-align: left;
        padding: 12px 12px;
        border-bottom: 1px solid var(--border)
    }

    .table th {
        font-size: 12px;
        letter-spacing: .02em;
        text-transform: uppercase;
        color: #6b7280
    }

    .table tbody tr:hover {
        background: #fafafa
    }

    .table .actions a {
        margin-right: 8px
    }

.table-responsive {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px
}

/* Alerts */
.alert {
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    background: #fff
}

    .alert.success {
        border-color: var(--brand-200);
        background: var(--brand-50);
        color: var(--brand-800)
    }

    .alert.error {
        border-color: #fecaca;
        background: #fef2f2;
        color: #b91c1c
    }

/* Prose (HTML editor output) */
.prose {
    color: #111827
}

    .prose h1, .prose h2, .prose h3 {
        margin: 1em 0 .5em
    }

    .prose p {
        margin: .6em 0
    }

    .prose ul, .prose ol {
        padding-left: 1.2rem;
        margin: .6em 0
    }

    .prose a {
        color: var(--brand-700)
    }

/* Hero / gradient helpers */
.hero {
    background: linear-gradient(180deg, rgba(0,208,132,.08), rgba(0,208,132,0)), #fff;
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 24px
}

/* Small helpers */
.m0 {
    margin: 0
}

.mt8 {
    margin-top: 8px
}

.mt12 {
    margin-top: 12px
}

.mt16 {
    margin-top: 16px
}

.p8 {
    padding: 8px
}

.p12 {
    padding: 12px
}

.p16 {
    padding: 16px
}

.flex {
    display: flex
}

.items-center {
    align-items: center
}

.justify-between {
    justify-content: space-between
}
/* === Admin Layout ========================================================= */
.admin-body {
    background: var(--bg)
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100dvh;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 10px;
    transition: width .2s ease;
}

.admin-main {
    display: flex;
    flex-direction: column;
    min-width: 0
}

.admin-topbar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-content {
    padding: 16px 16px 24px
}

.admin-footer {
    border-top: 1px solid var(--border);
    background: #fff;
    padding: 12px 0
}

/* Sidebar brand + controls */
.side-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 6px 10px
}

.side-logo img {
    height: 32px;
    width: auto
}

.side-collapse {
    border: 1px solid var(--border);
    border-radius: 8px;
    height: 36px;
    width: 36px;
    background: #fff;
    cursor: pointer;
}

/* Side nav */
.side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.side-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 12px;
    color: #111827;
    text-decoration: none;
}

    .side-item .icon {
        width: 20px;
        height: 20px;
        color: #374151;
        display: inline-flex
    }

        .side-item .icon svg {
            width: 20px;
            height: 20px
        }

    .side-item:hover {
        background: var(--brand-50)
    }

    .side-item.active {
        background: var(--brand-50);
        color: var(--brand-800);
        font-weight: 700
    }

        .side-item.active .icon {
            color: var(--brand-700)
        }

/* Topbar mobile toggle */
.side-toggle {
    display: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    height: 36px;
    width: 36px;
    background: #fff;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px
}

/* Collapse (desktop) */
.admin-collapsed .admin-shell {
    grid-template-columns: 76px 1fr
}

.admin-collapsed .admin-sidebar {
    width: 76px;
    padding: 12px 8px
}

.admin-collapsed .side-item .label {
    display: none
}

.admin-collapsed .side-brand .side-logo {
    display: none
}

/* Responsive: sidebar overlay on small screens */
@media (max-width: 980px) {
    .admin-shell {
        grid-template-columns: 1fr
    }

    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        transform: translateX(-100%);
        z-index: 60;
        box-shadow: var(--shadow)
    }

        .admin-sidebar.open {
            transform: translateX(0);
            transition: transform .2s ease
        }

    .side-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center
    }
}
