/* SERONA PRODUCTION SYSTEM - Visual Standard Implementation */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --serona-primary: #00C899;
    --serona-dark: #151628;
    --serona-bg: #F5F6FA;
    --input-bg: #F4F5F7;
    --card-shadow: 0 10px 40px rgba(0,0,0,0.08);
    --card-radius: 20px;
    
    /* Bootstrap Overrides */
    --bs-primary: var(--serona-primary);
    --bs-body-bg: var(--serona-bg);
    --bs-font-sans-serif: 'Inter', sans-serif;
}

/* --- THEMES --- */
body.theme-blue {
    --serona-primary: #3B7DDD;
    --bs-primary: #3B7DDD;
}

body.theme-purple {
    --serona-primary: #6f42c1;
    --bs-primary: #6f42c1;
}

body.theme-orange {
    --serona-primary: #fd7e14;
    --bs-primary: #fd7e14;
}

body.theme-dark {
    --serona-bg: #1a1a1a;
    --serona-dark: #000000;
    --input-bg: #2d2d2d;
    --bs-body-bg: #1a1a1a;
    color: #e2e8f0 !important;
}

body.theme-dark .card, body.theme-dark .modal-content {
    background-color: #2d2d2d !important;
    color: #e2e8f0 !important;
}

body.theme-dark .form-control, body.theme-dark .form-select {
    color: #fff !important;
}

body.theme-dark .table {
    color: #e2e8f0 !important;
}

body.theme-dark .table thead th {
    background-color: #1a1a1a !important;
    color: #94a3b8 !important;
}

body.theme-dark .bg-light {
    background-color: #1a1a1a !important;
}

body.theme-dark .text-dark, body.theme-dark h1, body.theme-dark h2, body.theme-dark h3, body.theme-dark h4, body.theme-dark h5, body.theme-dark h6 {
    color: #fff !important;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--serona-bg) !important;
    color: #334155;
}

/* --- CARDS & CONTAINERS --- */
.card, .modal-content {
    background-color: #fff !important;
    border: none !important;
    border-radius: var(--card-radius) !important;
    box-shadow: var(--card-shadow) !important;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1) !important;
}

.card-header {
    background-color: transparent !important;
    border-bottom: 1px solid rgba(0,0,0,0.03) !important;
    padding: 20px 25px !important;
}

.card-title {
    color: #64748b !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

/* --- FORMS & INPUTS --- */
.form-control, .form-select {
    background-color: var(--input-bg) !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 0.75rem 1rem !important;
    color: #1e293b !important;
    transition: all 0.2s ease-in-out;
}

.form-control:focus, .form-select:focus {
    background-color: #fff !important;
    box-shadow: 0 0 0 4px rgba(0, 200, 153, 0.15) !important;
    outline: none !important;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
    margin-bottom: 8px;
}

/* --- BUTTONS --- */
.btn-primary, .btn-success {
    background-color: var(--serona-primary) !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 10px 24px !important;
    color: #fff !important;
    font-weight: 600 !important;
    transition: all 0.3s ease;
}

.btn-primary:hover, .btn-success:hover {
    background-color: #00b388 !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 200, 153, 0.3) !important;
}

.btn-secondary {
    background-color: #f1f5f9 !important;
    border: none !important;
    border-radius: 12px !important;
    color: #475569 !important;
    font-weight: 600 !important;
}

/* --- SIDEBAR --- */
.sidebar {
    background-color: var(--serona-dark) !important;
    min-width: 280px;
    max-width: 280px;
}

.sidebar-content {
    background-color: transparent !important;
}

.sidebar-link, a.sidebar-link {
    padding: 12px 20px !important;
    color: #e2e8f0 !important; /* Brighter Slate 200 for maximum contrast on dark */
    border-radius: 12px !important;
    margin: 4px 15px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.2s;
}

.sidebar-link i, 
.sidebar-link svg {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: #94a3b8; /* Slate 400 */
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

.sidebar-item.active .sidebar-link {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
}

.sidebar-item.active .sidebar-link i, 
.sidebar-item.active .sidebar-link svg {
    color: var(--serona-primary) !important;
}

/* --- SIDEBAR PROFILE --- */
.sidebar-profile {
    text-align: center;
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-img {
    width: 80px;
    height: 80px;
    border-radius: 50% !important;
    border: 3px solid rgba(255, 255, 255, 0.2) !important;
    object-fit: cover;
    margin-bottom: 10px;
}

.profile-name {
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 1.1rem;
    display: block;
    margin-top: 5px;
}

.profile-role {
    color: var(--serona-primary) !important;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.menu-label {
    padding: 25px 35px 10px !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    color: #94a3b8 !important; /* Much brighter than before */
}

/* --- TABLES --- */
.table-container {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 10px;
    box-shadow: var(--card-shadow);
}

.table {
    background-color: #fff !important;
    margin-bottom: 0;
}

.table thead th {
    background-color: transparent !important;
    border-bottom: 1px solid #f1f5f9 !important;
    color: #94a3b8 !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    padding: 15px 20px !important;
}

.table tbody td {
    padding: 15px 20px !important;
    vertical-align: middle !important;
    border-bottom: 1px solid #f8fafc !important;
    color: #475569;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc !important;
}

/* --- SCROLLBARS --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--serona-bg);
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* --- REFINED TABLE STYLES --- */
.table thead th {
    background-color: #F8FAFC !important;
    border-bottom: 2px solid #E2E8F0 !important;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 200, 153, 0.03) !important;
    cursor: pointer;
}

/* --- IMPROVED BADGES --- */
.badge-soft-primary { background-color: rgba(0, 200, 153, 0.1); color: #00C899; }
.badge-soft-success { background-color: rgba(34, 197, 94, 0.1); color: #22c55e; }
.badge-soft-danger { background-color: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-soft-warning { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-soft-info { background-color: rgba(59, 130, 246, 0.1); color: #3b82f6; }

/* --- TIMELINE ENHANCEMENTS --- */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 5px;
    bottom: 0;
    width: 2px;
    background: #E2E8F0;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -24px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00C899;
    border: 2px solid #fff;
    box-shadow: 0 0 0 3px rgba(0, 200, 153, 0.2);
    z-index: 1;
}

/* --- UTILITIES --- */
.uppercase { text-transform: uppercase; }
.fs-xs { font-size: 0.75rem; }
.fs-xxs { font-size: 0.65rem; }
.italic { font-style: italic; }

.menu-label {
    padding: 20px 25px 10px !important;
    font-size: 0.65rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    color: rgba(255, 255, 255, 0.3) !important;
}

.sidebar-profile .profile-img {
    transition: all 0.3s ease;
}

.sidebar-profile:hover .profile-img {
    transform: scale(1.05);
    border-color: var(--serona-primary) !important;
}

/* --- ANIMATIONS (Phase 4.1) --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulseSoft {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-pulse-soft {
    animation: pulseSoft 2s infinite ease-in-out;
}

/* Staggered delays for a professional feel */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* Apply fadeInUp to all cards by default for a cohesive entry */
.card {
    animation: fadeInUp 0.6s ease-out both;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.15s; }

/* --- MOBILE RESPONSIVENESS (Prompt Implementation) --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

@media (max-width: 992px) {
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Hide Sidebar by default on mobile */
    .sidebar {
        margin-left: -280px !important; /* Force override with correct width */
        transition: margin-left 0.3s ease-in-out;
        position: fixed;
        z-index: 1050;
        height: 100vh;
        width: 280px;
        overflow-y: auto !important; /* Fix mobile scrolling */
    }

    /* Show Sidebar when active */
    .sidebar.toggled {
        margin-left: 0 !important;
    }

    .wrapper.sidebar-open .sidebar {
        margin-left: 0 !important;
    }

    /* Fix for the main content when sidebar is open on mobile */
    .wrapper.sidebar-open .main {
        overflow: hidden;
    }
}

/* Desktop Toggled (Collapsed) */
@media (min-width: 993px) {
    .sidebar {
        transition: all 0.3s ease-in-out;
    }
    
    .sidebar.collapsed {
        margin-left: -280px !important;
    }
}

/* Hamburger Icon Styling (AdminKit style) */
.hamburger, .hamburger:after, .hamburger:before {
    cursor: pointer;
    border-radius: 1px;
    height: 3px;
    width: 24px;
    background: #495057;
    display: block;
    content: "";
    transition: all .1s ease-in-out;
    position: relative;
}

.hamburger:before {
    top: -7px;
}

.hamburger:after {
    bottom: -10px;
}

.sidebar-toggle {
    cursor: pointer;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

/* Ensure icons are visible and have enough contrast */
.sidebar-link i, .sidebar-link svg {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: #8A94A6;
}

/* Floating Action Button (FAB) */
.btn-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50% !important;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    padding: 0 !important;
}

/* --- MODERN TOASTS (Phase 5) --- */
.toast-container {
    z-index: 2000 !important;
}

.toast-custom {
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px);
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
    overflow: hidden;
    margin-bottom: 12px;
    min-width: 320px;
    border-left: 6px solid #ccc !important;
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-custom.success { border-left-color: var(--serona-primary) !important; }
.toast-custom.error { border-left-color: #ef4444 !important; }
.toast-custom.warning { border-left-color: #f59e0b !important; }
.toast-custom.info { border-left-color: #3b82f6 !important; }

.toast-custom .toast-body {
    padding: 16px 20px !important;
    color: #1e293b !important;
    font-weight: 500;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* --- GLOBAL TEXT VISIBILITY & ACCESSIBILITY FIX (FINAL) --- */
:root {
    --bs-body-color: #0f172a !important; 
    --bs-secondary-color: #334155 !important;
    --bs-heading-color: #020617 !important;
}

body, .bg-white, .bg-light, .card, .modal-content, .offcanvas {
    color: #0f172a !important;
}

.opacity-25, .opacity-50, .opacity-75 {
    opacity: 0.9 !important;
}

.text-muted, .text-secondary, .small, .text-muted-foreground, .fs-sm, .text-black-50 {
    color: #334155 !important;
}

i, svg {
    opacity: 1 !important;
}

.text-muted i, .text-muted svg,
.text-secondary i, .text-secondary svg {
    color: #475569 !important;
}

.card-title, .h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
    color: #020617 !important;
    font-weight: 700 !important;
    opacity: 1 !important;
}

.small.uppercase, .text-uppercase.small, label.small {
    color: #334155 !important;
    font-weight: 800 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
}

.table {
    color: #0f172a !important;
}

.table thead th {
    color: #1e293b !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    font-size: 0.75rem;
    background-color: #F8FAFC !important;
    border-bottom: 2px solid #E2E8F0 !important;
}

.bg-primary {
    background-color: var(--serona-primary) !important;
    color: #0f172a !important;
}

.bg-primary *, .bg-primary .text-white, .bg-primary span, .bg-primary div {
    color: #0f172a !important;
    opacity: 1 !important;
}

.bg-primary-soft { background-color: rgba(0, 200, 153, 0.15) !important; color: #008567 !important; }
.bg-info-soft { background-color: rgba(59, 130, 246, 0.15) !important; color: #1d4ed8 !important; }
.bg-success-soft { background-color: rgba(34, 197, 94, 0.15) !important; color: #15803d !important; }
.bg-warning-soft { background-color: rgba(245, 158, 11, 0.15) !important; color: #b45309 !important; }
.bg-danger-soft { background-color: rgba(239, 68, 68, 0.15) !important; color: #b91c1c !important; }

.badge {
    font-weight: 700 !important;
    padding: 0.4em 0.65em !important;
}

/* --- MOBILE SIDEBAR SCROLL FIX --- */
@media (max-width: 992px) {
    .sidebar {
        overflow-y: auto !important;
        max-height: 100vh;
    }
}


/* Fix for information only visible when selected */
span, div, td, th {
    /* Prevent transparent or accidentally same-color text as background */
    text-shadow: none;
}

/* Improved focus accessibility */
:focus-visible {
    outline: 3px solid rgba(0, 200, 153, 0.4) !important;
}
