/* ========================================
   MODERN UI/UX THEME - MUQABALA
   ======================================== */

/* Global Font Configuration */
body,
h1,
h2,
h3,
h4,
h5,
h6,
.btn,
.form-control,
.navbar-brand {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Color Palette - Modern & Vibrant */
:root {
    /* Primary - Warm Royal Gold/Purple Mix */
    --bs-primary: #8e44ad;
    /* Wisteria */
    --bs-primary-rgb: 142, 68, 173;
    --bs-primary-dark: #732d91;
    --bs-primary-light: #a569bd;

    /* Secondary - Warm Grey */
    --bs-secondary: #7f8c8d;
    --bs-secondary-rgb: 127, 140, 141;

    /* Success - Emerald */
    --bs-success: #2ecc71;
    --bs-success-rgb: 46, 204, 113;

    /* Info - Sky Blue */
    --bs-info: #3498db;
    --bs-info-rgb: 52, 152, 219;

    /* Warning - Orange */
    --bs-warning: #e67e22;
    --bs-warning-rgb: 230, 126, 34;

    /* Danger - Alizarin */
    --bs-danger: #e74c3c;
    --bs-danger-rgb: 231, 76, 60;

    /* Neutrals - Warm Tones */
    --bs-light: #fdfbf7;
    /* Warm white/cream */
    --bs-dark: #2c3e50;
    --bs-body-color: #34495e;
    --bs-heading-color: #2c3e50;
    --bs-border-color: #ecf0f1;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

html body {
    background-color: #fdfbf7 !important;
    background-image:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, rgba(253, 251, 247, 0) 70%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4af37' fill-opacity='0.1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") !important;
    min-height: 100vh;
    position: relative;
}

/* Ensure body background is visible through layout wrappers */
.layout-wrapper,
.layout-container,
.layout-page {
    background-color: transparent !important;
}

/* The Frame - Elegant Gold Border - Removed */
/*
body::before {
    content: "";
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 16px;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 30px rgba(212, 175, 55, 0.05);
}

body::after {
    content: "";
    position: fixed;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 20px;
    pointer-events: none;
    z-index: 9999;
}
 */

/* Typography - Enhanced Hierarchy */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--bs-heading-color);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
    font-weight: 600;
}

h5 {
    font-size: 1.125rem;
    font-weight: 600;
}

h6 {
    font-size: 1rem;
    font-weight: 600;
}

body {
    color: var(--bs-body-color);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.text-muted {
    color: #64748b !important;
}

/* Cards - Modern Elevation */
.card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background-color: #f8fafc;
    border-bottom: 1px solid var(--bs-border-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons - Premium Feel */
.btn:not(.rounded-pill):not(.btn-icon) {
    font-weight: 600;
    letter-spacing: 0.025em;
    padding: 0.625rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.btn {
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    color: #ffffff !important;
}

.btn-secondary {
    background-color: #64748b;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #475569;
    color: #ffffff;
}

.btn-success {
    background-color: #10b981;
    color: #ffffff;
}

.btn-success:hover {
    background-color: #059669;
    color: #ffffff;
}

.btn-outline-primary {
    border: 2px solid #6366f1;
    color: #6366f1;
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: #6366f1;
    color: #ffffff;
    border-color: #6366f1;
}

/* Form Controls - Clean & Modern */
.form-control,
.form-select {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background-color: #ffffff;
}

.form-control:focus,
.form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--bs-heading-color);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

/* Navbar - Glassmorphism Enhanced */
.layout-navbar {
    background-color: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(12px) saturate(180%);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

/* Menu - Refined Sidebar - DISABLED to match original template */
/*
.menu-vertical {
    background-color: #ffffff;
    box-shadow: var(--shadow-md);
}

.menu-link {
    border-radius: 0.5rem;
    margin: 0.25rem 0.75rem;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    font-weight: 500;
    color: #475569;
}

.menu-link:hover {
    background-color: #f1f5f9;
    color: #6366f1;
}

.menu-item.active>.menu-link {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

    color: #ffffff;
}
*/

/* Badges - Modern Pills */
.badge {
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

/* Alerts - Soft & Friendly */
.alert {
    border-radius: 0.75rem;
    border: none;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.alert-info {
    background-color: #cffafe;
    color: #164e63;
}

/* Tables - Clean Design */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
    color: var(--bs-heading-color);
    padding: 1rem;
}

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

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

/* Micro-animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Loading States */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

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

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

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

/* Focus Visible - Accessibility */
*:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: 0.2s;
    transition-timing-function: ease;
}

/* Quote Card */
.quote-card {
    background: linear-gradient(135deg, #fffbf0 0%, #fff 100%);
    border: 1px solid #e2d1c3;
    border-left: 5px solid #d4af37;
    /* Gold accent */
}

.quote-text {
    font-family: 'Georgia', serif;
    font-style: italic;
    color: #5d4037;
    font-size: 1.1rem;
}

.quote-source {
    color: #8d6e63;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Select2 Contrast Fix */
.select2-results__option--highlighted[aria-selected] {
    background-color: #696cff !important;
    color: #ffffff !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #696cff !important;
    color: #ffffff !important;
}

/* ========================================
   MOBILE OPTIMIZATION
   ======================================== */
@media (max-width: 767.98px) {
    .layout-page {
        padding-bottom: 70px !important;
        /* Space for bottom nav */
    }

    .container-xxl {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .card {
        border-radius: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    .card-body {
        padding: 1rem !important;
    }

    /* Better touch targets */
    .btn,
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .dropdown-item {
        justify-content: flex-start;
    }

    /* Full width buttons on mobile */
    .d-grid-mobile {
        display: grid !important;
        width: 100% !important;
    }

    /* Adjust font sizes */
    h4 {
        font-size: 1.25rem !important;
    }

    h5 {
        font-size: 1.1rem !important;
    }

    /* Hide desktop elements */
    .hide-on-mobile {
        display: none !important;
    }

    /* Navbar adjustments */
    .navbar-brand {
        font-size: 1.2rem !important;
    }

    /* Responsive Tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Optional: Card view for tables on mobile if class .table-mobile-cards is added */
    .table-mobile-cards thead {
        display: none;
    }

    .table-mobile-cards tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--bs-border-color);
        border-radius: 0.5rem;
        background: #fff;
    }

    .table-mobile-cards tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
        border-bottom: 1px solid var(--bs-border-color);
        text-align: right;
    }

    .table-mobile-cards tbody td:last-child {
        border-bottom: none;
    }

    .table-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        text-align: left;
        margin-right: 1rem;
        color: var(--bs-heading-color);
    }
}

/* Glassmorphism Bottom Nav */
.glass-nav-bottom {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

/* ========================================
   TEMPLATE FIXES
   ======================================== */

/* Fix Global Link Underlines */
a {
    text-decoration: none !important;
}

a:hover {
    text-decoration: none !important;
}

.menu-link {
    text-decoration: none !important;
}

/* Fix Notification Bell Shape - Handled by .btn exclusion above */
/* .navbar-nav .nav-link.btn-icon { ... } - Removed */

/* Ensure badge is positioned correctly on round button */
.navbar-nav .nav-link.btn-icon .badge-dot {
    top: 6px !important;
    right: 6px !important;
}
/* Fix for mobile menu width covering screen */
@media (max-width: 1199.98px) {
    .layout-menu {
        width: 16.25rem !important;
        max-width: 85vw !important;
    }
}
