/* Botany UI â€” global contrast safety layer */

/* Dark themed surfaces must always use light foreground text. */
.bg-dark-purple,
.bg-dark-purple h1,
.bg-dark-purple h2,
.bg-dark-purple h3,
.bg-dark-purple h4,
.bg-dark-purple h5,
.bg-dark-purple h6,
.bg-dark-purple p,
.bg-dark-purple span,
.bg-dark-purple small,
.bg-dark-purple label,
.bg-dark-purple strong,
.bg-dark-purple b,
.bg-dark-purple a,
.card-header.bg-dark-purple,
.card-header.bg-dark-purple h1,
.card-header.bg-dark-purple h2,
.card-header.bg-dark-purple h3,
.card-header.bg-dark-purple h4,
.card-header.bg-dark-purple h5,
.card-header.bg-dark-purple h6,
.card-header.bg-dark-purple p,
.card-header.bg-dark-purple span,
.card-header.bg-dark-purple small,
.card-header.bg-dark-purple strong,
.card-header.bg-dark-purple b,
.card-header.bg-dark-purple a {
    color: #ffffff !important;
}

.bg-dark-purple .text-dark,
.bg-dark-purple .text-secondary,
.bg-dark-purple .text-muted {
    color: #f1f5f9 !important;
}

/* Purple solid surfaces */
.bg-purple,
.bg-purple h1,
.bg-purple h2,
.bg-purple h3,
.bg-purple h4,
.bg-purple h5,
.bg-purple h6,
.bg-purple p,
.bg-purple span,
.bg-purple small,
.bg-purple strong,
.bg-purple b {
    color: #ffffff !important;
}

/* Gold/yellow surfaces need dark text. */
.bg-gold,
.bg-warning,
.badge.bg-gold,
.badge.bg-warning,
.bg-gold-subtle,
.bg-warning-subtle {
    color: #1e293b !important;
}

.bg-gold a,
.bg-warning a,
.bg-gold-subtle a,
.bg-warning-subtle a {
    color: #1e293b !important;
}

/* Bootstrap subtle badges/icons: keep foreground colors readable on their own light surfaces. */
.bg-primary-subtle { color: #084298 !important; }
.bg-success-subtle { color: #0a3622 !important; }
.bg-info-subtle { color: #055160 !important; }
.bg-warning-subtle { color: #664d03 !important; }
.bg-danger-subtle { color: #58151c !important; }
.bg-secondary-subtle { color: #343a40 !important; }

/* Explicit light text utilities remain readable. */
.text-white { color: #ffffff !important; }
.text-white-75 { color: #f1f5f9 !important; }
.text-white-50 { color: #e2e8f0 !important; }

/* Light form controls always use dark readable text. */
.form-control,
.form-select,
textarea.form-control {
    color: #0f172a !important;
    background-color: #ffffff !important;
}

.form-control::placeholder,
.form-select::placeholder {
    color: #475569 !important;
    opacity: 1;
}

/* Light table rows must not inherit white text from themed parents. */
.table tbody td,
.table tbody th {
    color: #0f172a;
}

.table tbody .text-muted {
    color: #475569 !important;
}

/* Standard light overlays. */
.dropdown-menu,
.modal-content,
.offcanvas {
    color: #0f172a;
    background-color: #ffffff;
}

.dropdown-item {
    color: #0f172a;
}

/* Dark surfaces: normalize common Bootstrap text utilities so global heading rules cannot hide text. */
.bg-purple-darker,
.bg-purple,
.bg-dark-purple,
.bg-gradient-purple {
    color: #ffffff !important;
}

.bg-purple-darker :is(h1,h2,h3,h4,h5,h6,p,span,small,label,strong,b,a),
.bg-purple :is(h1,h2,h3,h4,h5,h6,p,span,small,label,strong,b,a),
.bg-dark-purple :is(h1,h2,h3,h4,h5,h6,p,span,small,label,strong,b,a),
.bg-gradient-purple :is(h1,h2,h3,h4,h5,h6,p,span,small,label,strong,b,a) {
    color: #ffffff !important;
}

.bg-purple-darker .text-dark,
.bg-purple-darker .text-secondary,
.bg-purple-darker .text-muted,
.bg-purple .text-dark,
.bg-purple .text-secondary,
.bg-purple .text-muted,
.bg-dark-purple .text-dark,
.bg-dark-purple .text-secondary,
.bg-dark-purple .text-muted,
.bg-gradient-purple .text-dark,
.bg-gradient-purple .text-secondary,
.bg-gradient-purple .text-muted {
    color: #f1f5f9 !important;
}

.bg-purple-darker .text-warning,
.bg-purple .text-warning,
.bg-dark-purple .text-warning,
.bg-gradient-purple .text-warning,
.bg-purple-darker .text-gold,
.bg-purple .text-gold,
.bg-dark-purple .text-gold,
.bg-gradient-purple .text-gold {
    color: #fef08a !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #3b0764 !important;
}

/* Admin dark hero/card headers: fix ALL heading levels. */
.admin-page .card-header.bg-dark-purple h1,
.admin-page .card-header.bg-dark-purple h2,
.admin-page .card-header.bg-dark-purple h3,
.admin-page .card-header.bg-dark-purple h4,
.admin-page .card-header.bg-dark-purple h5,
.admin-page .card-header.bg-dark-purple h6 {
    color: #ffffff !important;
}
/* CONTRAST-GLOBAL-SAFETY */
:root { --contrast-text:#0f172a; --contrast-muted:#475569; --contrast-on-dark:#fff; }
[class*="bg-dark"],[class*="bg-purple"],[class*="bg-gradient-purple"],.bg-primary,.bg-success,.bg-danger,.bg-info { color:#fff !important; }
[class*="bg-dark"] h1,[class*="bg-dark"] h2,[class*="bg-dark"] h3,[class*="bg-dark"] h4,[class*="bg-dark"] h5,[class*="bg-dark"] h6,[class*="bg-purple"] h1,[class*="bg-purple"] h2,[class*="bg-purple"] h3,[class*="bg-purple"] h4,[class*="bg-purple"] h5,[class*="bg-purple"] h6,[class*="bg-gradient-purple"] h1,[class*="bg-gradient-purple"] h2,[class*="bg-gradient-purple"] h3,[class*="bg-gradient-purple"] h4,[class*="bg-gradient-purple"] h5,[class*="bg-gradient-purple"] h6 { color:#fff !important; }
[class*="bg-dark"] .text-dark,[class*="bg-dark"] .text-secondary,[class*="bg-dark"] .text-muted,[class*="bg-purple"] .text-dark,[class*="bg-purple"] .text-secondary,[class*="bg-purple"] .text-muted,[class*="bg-gradient-purple"] .text-dark,[class*="bg-gradient-purple"] .text-secondary,[class*="bg-gradient-purple"] .text-muted { color:#f1f5f9 !important; }
.bg-light,.bg-white,.bg-primary-subtle,.bg-secondary-subtle,.bg-success-subtle,.bg-info-subtle,.bg-warning-subtle,.bg-danger-subtle,.bg-purple-light,.bg-purple-subtle,.bg-gold-subtle { color:#0f172a !important; }
.table,.table td,.table th,.card-body,.modal-body,.modal-header,.modal-footer { color:#0f172a; }

/* Responsive Layout System */
html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
}

.admin-wrapper {
    display: flex !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-height: 100vh;
    overflow-x: hidden !important;
}

.admin-main {
    flex: 1 1 0% !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-content {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed !important;
        left: -300px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: min(290px, 85vw) !important;
        max-width: 85vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1060 !important;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
    }

    .admin-sidebar.show {
        left: 0 !important;
        transform: translateX(0) !important;
    }

    .admin-content {
        padding: 0.85rem !important;
    }

    .admin-topbar {
        padding: 0.65rem 0.85rem !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1030 !important;
    }
}

