/**
 * She Is Shea Essentials — Jazzmin / AdminLTE brand overrides
 * Primary: #A07856 | Dark: #8b6748 | Light: #c9a882
 */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600&family=DM+Sans:wght@400;500;600&display=swap');

:root {
    --sheisshe-primary: #A07856;
    --sheisshe-primary-dark: #8b6748;
    --sheisshe-primary-light: #c9a882;
    --sheisshe-sidebar: #2a2520;
}

body,
.content-wrapper {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Top navbar & primary surfaces */
.navbar-primary,
.bg-primary,
.btn-primary,
.label-primary,
.badge-primary,
.callout.callout-primary,
.alert-primary {
    background-color: var(--sheisshe-primary) !important;
    border-color: var(--sheisshe-primary) !important;
}

.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active {
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary:not(:disabled):not(.disabled):active {
    background-color: var(--sheisshe-primary-dark) !important;
    border-color: var(--sheisshe-primary-dark) !important;
}

.btn-outline-primary {
    color: var(--sheisshe-primary) !important;
    border-color: var(--sheisshe-primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--sheisshe-primary) !important;
    border-color: var(--sheisshe-primary) !important;
    color: #fff !important;
}

.text-primary {
    color: var(--sheisshe-primary) !important;
}

/* Content links only — do not override buttons/nav */
.content-wrapper .card-body a:not(.btn):not(.button):not(.nav-link):not(.dropdown-item),
.module a:not(.btn):not(.button):not(.nav-link) {
    color: var(--sheisshe-primary);
}

.content-wrapper .card-body a:not(.btn):not(.button):not(.nav-link):hover,
.module a:not(.btn):not(.button):not(.nav-link):hover {
    color: var(--sheisshe-primary-dark);
}

.page-link {
    color: var(--sheisshe-primary);
}

.page-item.active .page-link {
    background-color: var(--sheisshe-primary);
    border-color: var(--sheisshe-primary);
    color: #fff;
}

/* Sidebar brand — shorter text + serif font, no clipping */
.sidebar-brand .brand-link {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 0.75rem;
    overflow: visible;
    min-height: 3.25rem;
}

.brand-link {
    background-color: var(--sheisshe-primary-dark) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.brand-link .brand-text {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    line-height: 1.15;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    flex: 1 1 auto;
    min-width: 0;
}

.sidebar-brand .brand-image {
    max-height: 34px;
    width: auto;
    flex-shrink: 0;
}

/* Top navbar quick links */
.app-header .navbar-nav .nav-link {
    white-space: nowrap;
    font-size: 0.875rem;
}

/* Sidebar */
.main-sidebar,
.sidebar-dark-primary {
    background-color: var(--sheisshe-sidebar) !important;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
.sidebar-dark-primary .nav-sidebar .nav-treeview > .nav-item > .nav-link.active {
    background-color: var(--sheisshe-primary) !important;
    color: #fff !important;
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link:hover {
    background-color: rgba(160, 120, 86, 0.25) !important;
}

/* Change-form action panel (Save, Delete, etc.) */
#jazzy-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

#jazzy-actions .submit-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    float: none;
    padding: 0;
    margin: 0;
    overflow: visible;
}

#jazzy-actions .submit-row > a {
    float: none !important;
    margin: 0 !important;
    width: 100%;
    height: auto !important;
    min-height: 2.35rem;
    line-height: 1.35 !important;
    padding: 0.5rem 0.75rem !important;
    text-align: center;
    text-decoration: none;
    border-radius: 0.375rem;
    display: block;
}

#jazzy-actions .d-flex.flex-wrap {
    flex-direction: column;
    width: 100%;
}

#jazzy-actions .d-flex .btn,
#jazzy-actions .d-flex input[type="submit"],
#jazzy-actions .d-flex a.btn {
    width: 100%;
    height: auto !important;
    min-height: 2.35rem;
    padding: 0.5rem 0.75rem !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.35;
    text-align: center;
    color: #fff !important;
}

#jazzy-actions input[name="_save"],
#jazzy-actions input[name="_saveasnew"] {
    background-color: var(--sheisshe-primary) !important;
    border-color: var(--sheisshe-primary) !important;
}

#jazzy-actions input[name="_addanother"],
#jazzy-actions input[name="_continue"] {
    background-color: var(--sheisshe-primary-dark) !important;
    border-color: var(--sheisshe-primary-dark) !important;
}

#jazzy-actions .btn-danger {
    background-color: #c0392b !important;
    border-color: #c0392b !important;
    color: #fff !important;
}

#jazzy-actions .btn-secondary {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #fff !important;
}

#jazzy-actions .btn-resend-email {
    background-color: #3b5b63 !important;
    border-color: #3b5b63 !important;
    color: #fff !important;
}

#jazzy-actions .btn-resend-email:hover {
    background-color: #2f484f !important;
    border-color: #2f484f !important;
    color: #fff !important;
}

#jazzy-actions .object-tools {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

#jazzy-actions .object-tools li {
    margin: 0;
    width: 100%;
}

#jazzy-actions .object-tools li a,
#jazzy-actions .object-tools a {
    color: var(--bs-body-color) !important;
    background-color: var(--bs-secondary-bg);
}

#jazzy-actions .object-tools li a:hover,
#jazzy-actions .object-tools a:hover {
    color: var(--bs-body-color) !important;
}

/* Changelist toolbar buttons (Add, Export, etc.) */
#change-list-filters .btn {
    white-space: nowrap;
    color: #fff !important;
}

/* Login — large logo under cream overlay (form keeps theme styling) */
.sheisshe-login-page.login-page {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: transparent !important;

    /*
     * Overlay opacity — change these two numbers (0 to 1):
     *   lower  = more logo shows through (e.g. 0.65)
     *   higher = creamier / logo fades more (e.g. 0.92)
     */
    --sheisshe-login-overlay-start: 0.20;
    --sheisshe-login-overlay-end: 0.90;
    --sheisshe-login-logo-size: min(92vw, 560px);
}

.sheisshe-login-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(
            135deg,
            rgba(245, 240, 235, var(--sheisshe-login-overlay-start)) 0%,
            rgba(232, 221, 211, var(--sheisshe-login-overlay-end)) 100%
        ),
        var(--sheisshe-login-logo);
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    background-size: auto, var(--sheisshe-login-logo-size);
}

.sheisshe-login-page .login-box {
    position: relative;
    z-index: 2;
}

.sheisshe-login-page .login-logo img {
    max-width: 120px;
    margin-bottom: 0.25rem;
}

.sheisshe-login-card {
    border: none !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 45px rgba(42, 37, 32, 0.15) !important;
}

.sheisshe-login-page .password-toggle-btn {
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.sheisshe-login-page .password-toggle-btn:hover,
.sheisshe-login-page .password-toggle-btn:focus {
    color: var(--sheisshe-primary);
    outline: none;
}

.sheisshe-login-page .password-toggle-btn:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(160, 120, 86, 0.35);
}

.register-page {
    background: linear-gradient(135deg, #f5f0eb 0%, #e8ddd3 100%) !important;
}

.login-box .btn-primary,
.register-box .btn-primary {
    background-color: var(--sheisshe-primary) !important;
    border-color: var(--sheisshe-primary) !important;
    color: #fff !important;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
}

.login-box .btn-primary:hover,
.register-box .btn-primary:hover {
    background-color: var(--sheisshe-primary-dark) !important;
    border-color: var(--sheisshe-primary-dark) !important;
}

.login-logo a,
.register-logo a {
    color: var(--sheisshe-primary-dark) !important;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
}

/* Dashboard cards & changelist */
.card-primary:not(.card-outline) > .card-header {
    background-color: var(--sheisshe-primary);
}

.card-primary.card-outline {
    border-top-color: var(--sheisshe-primary);
}

.card-primary.card-outline .card-header {
    color: var(--sheisshe-primary-dark);
}

/* Legacy submit rows on custom admin templates */
.submit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.submit-row input[type="submit"],
.submit-row a.button,
.submit-row .btn {
    width: auto !important;
    height: auto !important;
    min-height: 2.25rem;
    padding: 0.5rem 1rem !important;
    white-space: nowrap;
    color: #fff !important;
}

input[type="submit"].default,
.submit-row input.default {
    background: var(--sheisshe-primary) !important;
    border-color: var(--sheisshe-primary) !important;
}

input[type="submit"].default:hover,
.submit-row input.default:hover {
    background: var(--sheisshe-primary-dark) !important;
}

/* Custom inline action buttons from core/admin.py */
.cancel-btn,
.booking-actions a[style*="background-color"] {
    border-radius: 4px;
}

/* ---- Existing custom_admin.css (consultation services column) ---- */
th.column-get_services_display {
    width: 24% !important;
}

td.field-get_services_display div {
    max-width: 300px;
    font-size: 11px;
    white-space: normal;
    word-break: break-word;
}

/* Collapsed admin fieldsets (e.g. System Fields on consultations) */
.fieldset-collapsed-toggle {
    cursor: pointer;
    user-select: none;
}

.fieldset-collapsed-toggle .fieldset-collapse-icon {
    transition: transform 0.2s ease;
    opacity: 0.75;
}

.fieldset-collapsed-toggle[aria-expanded="true"] .fieldset-collapse-icon {
    transform: rotate(180deg);
}

.fieldset-description,
.fieldset-description-inline {
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Read-only system fields — prevent overflow */
.admin-readonly-value {
    max-width: 100%;
    overflow-x: auto;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.field-get_modification_history .admin-readonly-value {
    padding: 0;
    background: transparent;
    border: none;
}

.modification-history-wrap {
    overflow-x: auto;
    max-width: 100%;
}

.modification-history-table {
    width: 100%;
    min-width: 520px;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.modification-history-table th,
.modification-history-table td {
    padding: 0.4rem 0.5rem;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    text-align: left;
}

.modification-history-table th {
    font-weight: 600;
    background: rgba(160, 120, 86, 0.12);
}

.modification-history-table td:nth-child(1) { width: 18%; }
.modification-history-table td:nth-child(2),
.modification-history-table td:nth-child(3) { width: 16%; }
.modification-history-table td:nth-child(4) { width: 18%; }
.modification-history-table td:nth-child(5) { width: 32%; }

[data-bs-theme="dark"] .modification-history-table th,
[data-bs-theme="dark"] .modification-history-table td {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .modification-history-table th {
    background: rgba(160, 120, 86, 0.2);
}
