/* ═══════════════════════════════════════════════
   APP.CSS — Admin styles
   Bootstrap handles base .btn, .form-control etc.
   This file adds custom admin classes on top.
   ═══════════════════════════════════════════════ */

/* ── Admin Layout ── */

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

/* ── Sidebar ── */

.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #2d3328;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(0,0,0,0.15);
}

.admin-sidebar-brand {
    padding: 2rem 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.admin-brand-eyebrow {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6d7e61;
    margin-bottom: 0.3rem;
}

.admin-brand-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff !important;
    text-decoration: none !important;
    letter-spacing: 0.01em;
    display: block;
}

.admin-brand-title:hover {
    color: rgba(255,255,255,0.85) !important;
    text-decoration: none !important;
}

/* ── Nav Section ── */

.admin-nav-section {
    flex: 1;
    padding: 1.25rem 0.75rem 0.5rem;
}

.admin-nav-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.admin-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.admin-nav-item {
    margin-bottom: 2px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.875rem;
    color: rgba(255,255,255,0.55);
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 2px solid transparent;
}

.admin-nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.9);
    text-decoration: none;
}

.admin-nav-link.active {
    background: rgba(109,126,97,0.2);
    color: #a8bc9a;
    border-left-color: #6d7e61;
    font-weight: 600;
}

.admin-nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.8;
}

.admin-nav-link.active .admin-nav-icon {
    opacity: 1;
}

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

.admin-sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.07);
    margin: 0.5rem 0.875rem;
}

/* ── Content Area ── */

.admin-content {
    flex: 1;
    padding: 2.5rem 3rem;
    min-width: 0;
}

/* ── Page Header ── */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e4e4df;
}

.admin-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3328;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ── Cards ── */

.admin-card {
    background: #fff;
    padding: 1.75rem;
    box-shadow: 0 1px 4px rgba(45,51,40,0.06), 0 4px 16px rgba(45,51,40,0.04);
    border: 1px solid #e4e4df;
}

.admin-card h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #9a9e94;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0ec;
}

/* ── Stats ── */

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

.stat-card {
    background: #fff;
    padding: 1.5rem 1.75rem;
    border: 1px solid #e4e4df;
    border-top: 3px solid #6d7e61;
    box-shadow: 0 1px 4px rgba(45,51,40,0.06), 0 4px 16px rgba(45,51,40,0.04);
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45,51,40,0.1), 0 8px 24px rgba(45,51,40,0.06);
}

.stat-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    color: #2d3328;
    line-height: 1;
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9a9e94;
}

/* ── Table ── */

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

.admin-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9a9e94;
    background: #fafaf7;
    border-bottom: 2px solid #e4e4df;
}

.admin-table td {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid #f2f2ee;
    color: #2d3328;
    vertical-align: middle;
}

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

.admin-table tbody tr {
    transition: background 0.1s;
}

.admin-table tbody tr:hover td {
    background: #fafaf7;
}

.admin-table a {
    color: #4a5a40;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s;
}

.admin-table a:hover {
    color: #6d7e61;
    text-decoration: underline;
}

/* ── Bootstrap button color overrides ── */

.btn-primary {
    background-color: #6d7e61;
    border-color: #6d7e61;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.5rem 1.25rem;
    transition: background 0.15s, border-color 0.15s;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #4a5a40 !important;
    border-color: #4a5a40 !important;
    color: #fff !important;
}

.btn-danger {
    background-color: #c0392b;
    border-color: #c0392b;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.btn-danger:hover {
    background-color: #a93226 !important;
    border-color: #a93226 !important;
}

/* ── Custom btn-outline (not a Bootstrap variant) ── */

.btn-outline {
    background: transparent;
    color: #4a5a40;
    border: 1.5px solid #c4cdb8;
    padding: 0.45rem 1rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-outline:hover {
    background: #6d7e61;
    border-color: #6d7e61;
    color: #fff;
    text-decoration: none;
}

.btn-sm.btn-outline {
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
    text-transform: none;
    letter-spacing: 0.02em;
}

.btn-sm.btn-danger {
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
}

.btn-icon svg {
    width: 20px;
    height: 20px;
    transition: stroke 0.2s ease;
}

.btn-outline.btn-icon {
    color: #6d7e61;
}

.btn-outline.btn-icon:hover {
    color: #fff;
}

.btn-danger.btn-icon {
    color: #fff;
}

.btn-danger.btn-icon:hover {
    color: #fff;
}

/* ── Form utilities (Bootstrap 5 removed form-group) ── */

.form-group {
    margin-bottom: 1.35rem;
}

.form-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6a6e64;
    margin-bottom: 0.45rem;
    display: block;
}

.form-control {
    border-color: #ddddd8;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    color: #2d3328;
    padding: 0.55rem 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    border-color: #6d7e61;
    box-shadow: 0 0 0 3px rgba(109,126,97,0.15);
}

.validation-message {
    display: block;
    margin-top: 5px;
    font-size: 0.75rem;
    color: #c0392b;
    font-weight: 500;
}

/* ── Grid utility ── */

.grid {
    display: grid;
    gap: 1.25rem;
}

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

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

/* ── Alerts ── */

.alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background: #edf7f1;
    color: #1e6b40;
    border-left: 3px solid #2e7d50;
}

.alert-error {
    background: #fdf0ef;
    color: #c0392b;
    border-left: 3px solid #c0392b;
}

.alert-warning {
    background: #fef9ec;
    color: #92690a;
    border-left: 3px solid #f0b429;
}

/* ── Badges ── */

.badge {
    display: inline-block;
    padding: 0.22em 0.65em;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif;
}

.badge-primary {
    background: rgba(109,126,97,0.12);
    color: #4a5a40;
}

.badge-success {
    background: rgba(46,125,80,0.12);
    color: #1e6b40;
}

.badge-warning {
    background: #fef3cd;
    color: #92690a;
}

.badge-danger {
    background: rgba(192,57,43,0.1);
    color: #c0392b;
}

/* ── Spinner ── */

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0dc;
    border-top-color: #6d7e61;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* ── Gallery Grid (admin) ── */

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

/* ── Login Page ── */

.admin-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d3328;
    background-image: radial-gradient(ellipse at 60% 40%, rgba(109,126,97,0.18) 0%, transparent 60%);
}

.admin-login-card {
    background: #fff;
    border: 1px solid #e4e4df;
    overflow: hidden;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}

.admin-login-card-top {
    height: 4px;
    background: linear-gradient(90deg, #6d7e61, #4a5a40);
}

.admin-login-card-inner {
    padding: 3rem 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.admin-login-brand {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6d7e61;
    margin-bottom: 0.4rem;
}

.admin-login-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    color: #2d3328;
    margin-bottom: 1.75rem;
    letter-spacing: -0.01em;
    outline: none;
}

.admin-login-card-inner form {
    width: 70%;
    text-align: left;
}

.admin-login-card-inner .form-group,
.admin-login-card-inner .form-control {
    width: 100%;
}

.btn-login {
    display: block;
    width: 100%;
    margin-top: 1rem;
}

/* ── Gallery Slideshow (public) ── */

.gallery-slideshow-section {
    overflow: hidden;
}

.gallery-slideshow {
    position: relative;
    overflow: hidden;
    width: 100%;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}

.slideshow-track {
    display: flex;
    gap: 1.5rem;
    animation: slideshow-scroll 30s linear infinite;
    width: calc((320px + 1.5rem) * var(--slide-count) * 2);
}

.slideshow-track:hover {
    animation-play-state: paused;
}

.slideshow-slide {
    flex-shrink: 0;
    width: 320px;
    height: 240px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.slideshow-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.slideshow-slide:hover img {
    transform: scale(1.05);
}

.slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

@keyframes slideshow-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(-50%)); }
}

/* ── Blazor Error UI ── */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff3cd;
    color: #856404;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    z-index: 9999;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

#blazor-error-ui .reload {
    font-weight: 600;
    margin-left: 0.5rem;
    color: #856404;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-weight: 700;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ── Quill editor overrides ── */

/* Vertically center all toolbar icons */
.ql-toolbar button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
}

.ql-toolbar .ql-formats {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
}

/* Fix color picker (ql-picker-label) vertical alignment */
.ql-toolbar .ql-picker {
    vertical-align: middle !important;
    display: inline-flex !important;
    align-items: center !important;
}

.ql-toolbar .ql-picker-label {
    display: inline-flex !important;
    align-items: center !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.ql-toolbar .ql-color-picker .ql-picker-label svg,
.ql-toolbar .ql-picker-label svg {
    display: block;
}

/* ── Responsive ── */

@media (max-width: 991px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .admin-content {
        padding: 1.5rem;
    }

    .admin-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* iPad Pro and below (≤ 1100px): card layout for tables */
@media (max-width: 1100px) {
    .admin-content {
        padding: 1rem;
    }

    .admin-header h1 {
        font-size: 1.2rem;
    }

    .admin-card {
        overflow-x: hidden;
        padding: 1.25rem;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        box-sizing: border-box;
    }

    .admin-table tr {
        border: 1px solid #e4e4df;
        border-radius: 8px;
        margin-bottom: 0.625rem;
        padding: 0.125rem 0;
        background: #fafaf7;
    }

    .admin-table tbody tr:hover td {
        background: transparent;
    }

    .admin-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem 0.875rem;
        border: none;
        border-bottom: 1px solid #f2f2ee;
        font-size: 0.875rem;
        gap: 0.75rem;
        text-align: right;
    }

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

    .admin-table td::before {
        content: attr(data-label);
        font-size: 0.67rem;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
        color: #6d7e61;
        flex-shrink: 0;
        text-align: left;
    }

    .admin-table td.td-actions {
        justify-content: flex-end;
        gap: 0.5rem;
    }

    .admin-table td.td-actions::before {
        display: none;
    }
}

@media (max-width: 768px) {
    .slideshow-slide {
        width: 280px;
        height: 200px;
    }

    .slideshow-track {
        width: calc((280px + 1.5rem) * var(--slide-count) * 2);
        animation-duration: 25s;
    }
}

@media (max-width: 480px) {
    .slideshow-slide {
        width: 240px;
        height: 180px;
    }

    .slideshow-track {
        width: calc((240px + 1.5rem) * var(--slide-count) * 2);
        animation-duration: 20s;
    }
}
