/* Premium UI Enhancements for Fino
   Upgrades tables, cards, and interactions for a modern SaaS aesthetic
*/

/* -------------------------------------------------------------------------- */
/* 1. Global Micro-Animations & Interactivity
/* -------------------------------------------------------------------------- */
a, button, .btn, .dropdown-item, .nav-link {
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Tactile button press effect */
.btn:active, button:active {
    transform: scale(0.97);
}

/* Softer focus states for inputs */
.form-control:focus, .select2-container--default.select2-container--focus .select2-selection--multiple, .select2-container--default.select2-container--focus .select2-selection--single {
    box-shadow: 0 0 0 0.2rem rgba(68, 102, 242, 0.15) !important;
    border-color: #4466f2 !important;
}

/* -------------------------------------------------------------------------- */
/* 2. Modern Card Layouts & Shadows
/* -------------------------------------------------------------------------- */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden; /* Ensure contents respect rounded corners */
}

/* Soften the card header */
.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* -------------------------------------------------------------------------- */
/* 3. Premium Table & DataTables Styling
/* -------------------------------------------------------------------------- */

/* Responsive table wrapper ensures card border-radius is respected */
.table-responsive {
    border-radius: 8px;
    overflow-x: auto !important;
    width: 100%;
}

/* Custom Sleek Scrollbar for Tables */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.table {
    margin-bottom: 0;
    color: #495057;
}

/* Breathing room in cells */
.table th, .table td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    border-top: 1px solid rgba(0,0,0,0.04);
}

/* Clean, modern headers */
.table thead th {
    border-bottom: 2px solid rgba(0,0,0,0.06);
    background-color: #f8f9fa;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    border-top: none;
}

/* Hover dynamics for table rows */
.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover, .table-striped tbody tr:hover {
    background-color: #f1f4fb !important;
    transform: translateY(-1px); /* Micro-lift effect */
    box-shadow: inset 0 0 0 9999px rgba(68, 102, 242, 0.02);
}

/* Remove default striped harshness */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,0.015);
}

/* -------------------------------------------------------------------------- */
/* 4. DataTables Specifics (Pagination & Search)
/* -------------------------------------------------------------------------- */

/* Clean up the wrapper */
.dataTables_wrapper {
    padding: 1rem 0;
}

/* Search input rounding */
.dataTables_wrapper .dataTables_filter input {
    border-radius: 20px;
    padding: 0.375rem 1rem;
    border: 1px solid #ced4da;
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
    box-shadow: 0 0 0 0.2rem rgba(68, 102, 242, 0.15);
    border-color: #4466f2;
    outline: none;
}

/* Modern Pill Pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 50px !important;
    margin: 0 4px;
    border: none !important;
    background: #f8f9fa !important;
    color: #495057 !important;
    padding: 0.4rem 0.8rem;
    transition: all 0.2s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #e9ecef !important;
    color: #212529 !important;
    transform: translateY(-1px);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current, 
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: #4466f2 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(68, 102, 242, 0.3);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    background: transparent !important;
    cursor: not-allowed;
}

/* -------------------------------------------------------------------------- */
/* 5. Modal Fixes (Z-index & Backdrop)
/* -------------------------------------------------------------------------- */

/* Ensure the modal backdrop is fully blackish and sits above the sidebar */
.modal-backdrop {
    z-index: 9998 !important;
    background-color: #000000 !important;
}

.modal-backdrop.show {
    opacity: 0.6 !important; /* Make it a dark black overlay instead of blue */
}

/* Ensure the modal itself sits above the backdrop and sidebar */
.modal {
    z-index: 9999 !important;
    background-color: transparent !important; /* Remove the hardcoded blue background from styles.css */
}

/* Ensure Select2 dropdowns inside modals sit above the modal */
.select2-container--open {
    z-index: 99999 !important;
}

/* -------------------------------------------------------------------------- */
/* 6. Smooth Dropdown Animations & Positioning
/* -------------------------------------------------------------------------- */
.header-area .dropdown-menu {
    margin-top: 15px !important;
    -webkit-transition: all 0.3s ease 0s !important;
    transition: all 0.3s ease 0s !important;
    display: block !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.header-area .dropdown-menu.show {
    margin-top: 0px !important;
    visibility: visible !important;
    opacity: 1 !important;
}

@media (min-width: 992px) {
    /* Right-side dropdown alignment on desktop */
    .header-area .notification-area .dropdown-menu,
    .header-area .user-profile .dropdown-menu {
        top: 100% !important;
        right: 0px !important;
        left: auto !important;
        -webkit-transform: none !important;
        transform: none !important;
    }
    
    /* Left-side (Quick Action) dropdown container & alignment on desktop */
    .header-area .quick-create-dropdown {
        display: inline-flex !important;
        align-items: center !important;
        height: 55px !important;
    }

    .header-area .quick-create-dropdown .dropdown-menu {
        top: 100% !important;
        left: 0px !important;
        right: auto !important;
        -webkit-transform: none !important;
        transform: none !important;
    }
}

/* -------------------------------------------------------------------------- */
/* 7. Unified Dropdown Styling */
/* -------------------------------------------------------------------------- */
.dropdown-menu {
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.dropdown-menu:not(.calculator-menu):not(.notify-box) {
    padding: 6px 0 !important;
}

.dropdown-menu .dropdown-item,
.dropdown-menu a.dropdown-item {
    font-size: 13px !important;
    font-weight: 500 !important;
    padding: 8px 15px !important;
    color: #374151 !important;
    border-radius: 4px !important;
    margin: 2px 5px !important;
    display: flex !important;
    align-items: center !important;
    width: calc(100% - 10px) !important; /* Account for 5px margin on left and right */
    transition: all 0.15s ease !important;
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu a.dropdown-item:hover {
    background: rgba(37, 99, 235, 0.05) !important;
    color: #2563eb !important;
}

/* Ensure icons inside dropdown items are styled consistently */
.dropdown-menu .dropdown-item i {
    font-size: 14px !important;
    width: 20px !important;
    margin-right: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* -------------------------------------------------------------------------- */
/* 8. Mobile Dropdown Opening/Closing Transitions */
/* -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
    .header-area .dropdown-menu,
    .header-area .notification-area .dropdown-menu,
    .header-area .user-profile .dropdown-menu {
        margin-top: 15px !important;
        -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        display: block !important;
    }
    
    .header-area .dropdown-menu.show,
    .header-area .notification-area .dropdown-menu.show,
    .header-area .user-profile .dropdown-menu.show {
        margin-top: 0px !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Fix for datatables dropdown clipping */
.dataTables_wrapper,
.card-body,
.card,
.col-sm-12 {
    overflow: visible !important;
}
table.dataTable {
    border-collapse: collapse !important;
}

/* -------------------------------------------------------------------------- */
/* 9. High-Contrast & Beautiful Toast Notifications Override
/* -------------------------------------------------------------------------- */
.jq-toast-wrap {
    z-index: 10600 !important; /* Ensure it stays above everything, including Bootstrap Modals and SweetAlerts */
}

.jq-toast-single {
    border-radius: 8px !important;
    padding: 14px 20px 14px 48px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    border: none !important;
    color: #ffffff !important; /* Force text to be high contrast white */
    background-position: 14px center !important;
}

/* Ensure toast list items or headings inherit the correct color and typography */
.jq-toast-single, 
.jq-toast-single h2, 
.jq-toast-single ul, 
.jq-toast-single li, 
.jq-toast-single a {
    color: #ffffff !important;
    font-family: inherit !important;
}

.jq-toast-single.jq-icon-success {
    background-color: #10b981 !important; /* Vibrant Emerald Green */
}

.jq-toast-single.jq-icon-error {
    background-color: #ef4444 !important; /* Vibrant Red */
}

.jq-toast-single.jq-icon-warning {
    background-color: #f59e0b !important; /* Vibrant Amber/Orange */
}

.jq-toast-single.jq-icon-info {
    background-color: #3b82f6 !important; /* Vibrant Blue */
}

/* Align and clean up the close button */
.close-jq-toast-single {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 16px !important;
    top: 6px !important;
    right: 10px !important;
    transition: color 0.15s ease !important;
}

.close-jq-toast-single:hover {
    color: #ffffff !important;
}

/* Ensure the progress loader bar at the top of the toast looks slick */
.jq-toast-loader {
    height: 4px !important;
    top: 0 !important;
    background-color: rgba(255, 255, 255, 0.4) !important;
}

