﻿.toast-container {
    z-index: 9999; /* 🔥 ensure always on top */
}

.toast-custom {
    min-width: 280px;
    max-width: 350px;
    border-radius: 12px;
    padding: 14px 45px 14px 16px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    margin-bottom: 10px !important;
    animation: slideIn 0.4s ease;
    position: relative;
    pointer-events: auto; /* ✅ ensure clickable */
}

/* Icon */
.toast-icon {
    font-size: 18px;
}

/* Message */
.toast-message {
    flex: 1;
}

/* ✅ CLOSE BUTTON FIXED */
.toast-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px; /* 🔥 bigger hit area */
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    z-index: 2; /* 🔥 above everything */
    pointer-events: auto; /* 🔥 force click */

    transition: 0.2s;
}

    .toast-close:hover {
        background: rgba(255,255,255,0.25);
    }
/* Types */
.toast-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast-info {
    background: linear-gradient(135deg, #00b5ef, #292075);
}

/* Animation */
@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(120%);
    }
}


/* Table cell */
.loading {
    text-align: center;
    padding: 40px 0;
    background: var(--color-card-bg);
}

/* Loader wrapper */
.loader {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    position: relative;
}

    /* Ring */
    .loader::before {
        content: "";
        width: 100%;
        height: 100%;
        border-radius: 50%;
        border: 3px solid var(--color-border);
        border-top: 3px solid transparent;
        position: absolute;
        top: 0;
        left: 0;
    }

    /* Gradient rotating arc */
    .loader::after {
        content: "";
        width: 100%;
        height: 100%;
        border-radius: 50%;
        border: 3px solid transparent;
        border-top: 3px solid var(--color-accent-500);
        border-right: 3px solid var(--color-secondary-500);
        position: absolute;
        top: 0;
        left: 0;
        animation: spin 0.8s linear infinite;
    }

/* Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Base Button */
.btn {
    font-weight: 500;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    transition: all 0.2s ease;
}

/* Primary Button */
.btn-primary {
    background: var(--gradient-primary);
    color: var(--color-text-light);
    box-shadow: 0 4px 12px rgba(0, 181, 239, 0.25);
}

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(0, 181, 239, 0.35);
    }

    .btn-primary:active {
        transform: scale(0.97);
    }

/* Secondary Button */
.btn-secondary {
    background: var(--color-secondary-500);
    color: var(--color-text-light);
    box-shadow: 0 4px 10px rgba(41, 32, 117, 0.25);
}

    .btn-secondary:hover {
        background: var(--color-secondary-600);
        transform: translateY(-1px);
    }

    .btn-secondary:active {
        transform: scale(0.97);
    }

/* Outline Variant (optional but useful) */
.btn-outline-primary {
    background: transparent;
    color: var(--color-primary-500);
    border: 1px solid var(--color-primary-500);
}

    .btn-outline-primary:hover {
        background: var(--color-primary-500);
        color: white;
    }
/* Base Form Control */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--color-border);
    padding: 10px 12px;
    font-size: 14px;
    background: var(--color-card-bg);
    color: var(--color-text-primary);
    transition: all 0.2s ease;
}

    /* Placeholder */
    .form-control::placeholder {
        color: var(--color-text-secondary);
        opacity: 0.7;
    }

    /* Hover */
    .form-control:hover,
    .form-select:hover {
        border-color: var(--color-primary-300);
    }

    /* Focus State (IMPORTANT UX) */
    .form-control:focus,
    .form-select:focus {
        outline: none;
        border-color: var(--color-accent-500);
        box-shadow: 0 0 0 3px rgba(0, 181, 239, 0.15);
    }

    /* Disabled */
    .form-control:disabled,
    .form-select:disabled {
        background: var(--color-bg-secondary);
        cursor: not-allowed;
        opacity: 0.7;
    }

.form-label {
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.form-group {
    margin-bottom: 16px;
}
/* =========================================================
   Custom Select2 Theme (Your Design System)
   ========================================================= */

/* ===============================
   Selection Box (Single)
================================ */
.select2-container--default .select2-selection--single {
    height: 38px !important;
    padding: 0 12px !important;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-card-bg);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

    /* Selected text */
    .select2-container--default
    .select2-selection--single
    .select2-selection__rendered {
        color: var(--color-text-primary) !important;
        padding-left: 0 !important;
        font-size: 14px !important;
    }

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        color: var(--color-secondary-600) !important;
        line-height: 38px !important;
    }
.select2-selection__arrow b {
    border-color: #888 transparent transparent transparent;
    border-style: solid;
    border-width: 5px 4px 0 4px;
    height: 0;
    left: 50%;
    margin-left: -4px;
    margin-top: -2px;
    position: absolute;
    top: 65% !important;
    width: 0;
}
/* Placeholder */
.select2-container--default
.select2-selection__placeholder {
    color: var(--color-text-secondary);
}

/* Arrow */
.select2-container--default
.select2-selection--single
.select2-selection__arrow {
    height: 100%;
    right: 10px;
}

/* Hover */
.select2-container--default
.select2-selection--single:hover {
    border-color: var(--color-primary-300);
}

/* Focus / Open */
.select2-container--default.select2-container--focus
.select2-selection--single,
.select2-container--default.select2-container--open
.select2-selection--single {
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px rgba(0, 181, 239, 0.15);
}

/* Disabled */
.select2-container--default.select2-container--disabled
.select2-selection--single {
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: not-allowed;
}

/* ===============================
   Dropdown
================================ */
.select2-dropdown {
    background: var(--color-card-bg);
    border-radius: 10px;
    border: 1px solid var(--color-border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* ===============================
   Search Box
================================ */
.select2-search--dropdown
.select2-search__field {
    background: var(--color-bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    padding: 6px 10px;
    font-size: 13px;
    color: var(--color-text-primary);
    outline: none;
}

    .select2-search--dropdown
    .select2-search__field:focus {
        border-color: var(--color-accent-500);
        box-shadow: 0 0 0 2px rgba(0, 181, 239, 0.12);
    }

/* ===============================
   Options
================================ */
.select2-results__option {
    padding: 8px 12px;
    font-size: 14px;
    color: var(--color-text-secondary);
    transition: all 0.15s ease;
}

    /* Hover */
    .select2-results__option:hover {
        background: var(--color-bg-secondary);
        color: var(--color-text-primary);
    }

/* Highlighted (keyboard + mouse) */
.select2-container--default
.select2-results__option--highlighted[aria-selected] {
    background: rgba(0, 181, 239, 0.12) !important;
    color: var(--color-accent-600) !important;
}

/* Selected */
.select2-results__option--selected {
    background: rgba(0, 181, 239, 0.18) !important;
    color: var(--color-accent-700) !important;
    font-weight: 500;
}

/* No results */
.select2-results__message {
    padding: 10px;
    color: var(--color-text-secondary);
    font-style: italic;
}

/* ===============================
   Clear Icon
================================ */
.select2-selection__clear {
    color: var(--color-text-secondary);
    margin-right: 6px;
}

    .select2-selection__clear:hover {
        color: var(--color-error);
    }

/* ===============================
   Multiple Select
================================ */
.select2-container--default .select2-selection--multiple {
    min-height: 38px;
    padding: 4px 6px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-card-bg);
    transition: all 0.2s ease;
}

/* Focus */
.select2-container--default.select2-container--focus
.select2-selection--multiple,
.select2-container--default.select2-container--open
.select2-selection--multiple {
    border-color: var(--color-accent-500);
    box-shadow: 0 0 0 3px rgba(0, 181, 239, 0.15);
}

/* Selected tags */
.select2-selection__choice {
    background: var(--gradient-primary);
    border: none;
    border-radius: 6px;
    color: #fff;
    padding: 3px 8px;
    font-size: 12px;
    margin-top: 4px;
}

/* Remove icon */
.select2-selection__choice__remove {
    color: rgba(255,255,255,0.8);
    margin-right: 4px;
}

    .select2-selection__choice__remove:hover {
        color: #fff;
    }

/* Placeholder */
.select2-selection--multiple
.select2-selection__placeholder {
    color: var(--color-text-secondary);
}
/* =========================================
   Base Table Button
========================================= */
.tbutton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

    /* Hover lift */
    .tbutton:hover {
        transform: translateY(-1px);
    }

    /* Active press */
    .tbutton:active {
        transform: scale(0.96);
    }

/* =========================================
   View Button (tvbutton)
========================================= */
.tvbutton {
    background: rgba(0, 181, 239, 0.12);
    color: var(--color-accent-600);
    border-color: rgba(0, 181, 239, 0.25);
}

    .tvbutton:hover {
        background: rgba(0, 181, 239, 0.2);
        color: var(--color-accent-700);
    }

/* =========================================
   Delete Button (tdbutton)
========================================= */
.tdbutton {
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-error);
    border-color: rgba(239, 68, 68, 0.25);
}

    .tdbutton:hover {
        background: rgba(239, 68, 68, 0.2);
        color: #dc2626;
    }

/* =========================================
   Edit Button (tebutton)
========================================= */
.tebutton {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-warning);
    border-color: rgba(245, 158, 11, 0.25);
}

    .tebutton:hover {
        background: rgba(245, 158, 11, 0.2);
        color: #d97706;
    }

/* =========================================
   Modal Styles
========================================= */
.modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: var(--color-card-bg);
}

.modal-header {
    background: var(--gradient-primary);
    color: var(--color-text-light);
    border-bottom: none;
    border-radius: 16px 16px 0 0;
    padding: 1.25rem 1.5rem;
}

    .modal-header .modal-title {
        font-weight: 600;
        font-size: 1.25rem;
    }

    .modal-header .btn-close {
        filter: brightness(0) invert(1);
        opacity: 0.8;
    }

        .modal-header .btn-close:hover {
            opacity: 1;
        }

.modal-body {
    padding: 1.5rem;
    background: var(--color-bg-primary);
}

.modal-footer {
    border-top: 1px solid var(--color-border);
    padding: 1rem 1.5rem;
    background: var(--color-bg-primary);
    border-radius: 0 0 16px 16px;
}

/* =========================================
   Table Styles
========================================= */
.table {
    background: var(--color-card-bg);
    border-radius: 8px;
    overflow: hidden;
}

    .table thead {
        background: var(--color-bg-secondary);
    }

        .table thead th {
            color: var(--color-text-secondary);
            font-weight: 600;
            font-size: 0.875rem;
            text-transform: uppercase;
            letter-spacing: 0.025em;
            padding: 0.75rem 1rem;
            border-bottom: 2px solid var(--color-border);
        }

    .table tbody tr {
        transition: all 0.2s ease;
        border-bottom: 1px solid var(--color-border);
    }

        .table tbody tr:hover {
            background: var(--color-bg-secondary);
        }

    .table tbody td {
        padding: 0.75rem 1rem;
        color: var(--color-text-primary);
        vertical-align: middle;
    }

.table-responsive {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* =========================================
   Card Styles
========================================= */
.card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

    .card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

.card-header {
    background: var(--gradient-primary);
    color: var(--color-text-light);
    border-bottom: none;
    padding: 1rem 1.25rem;
    font-weight: 600;
    border-radius: 12px 12px 0 0;
}

.card-body {
    padding: 1.25rem;
    background: var(--color-bg-primary);
}

/* =========================================
   Breadcrumb Navigation
========================================= */
.breadcrumb {
    background: transparent;
    padding: 0.75rem 0;
    margin-bottom: 0;
}

    .breadcrumb .breadcrumb-item {
        font-size: 0.875rem;
    }

        .breadcrumb .breadcrumb-item a {
            color: var(--color-accent-600);
            text-decoration: none;
            transition: color 0.2s ease;
            font-weight: 500;
        }

            .breadcrumb .breadcrumb-item a:hover {
                color: var(--color-accent-700);
            }

        .breadcrumb .breadcrumb-item.active {
            color: var(--color-text-secondary);
        }

        .breadcrumb .breadcrumb-item + .breadcrumb-item::before {
            color: var(--color-text-secondary);
        }

/* =========================================
   Badge Styles
========================================= */
.badge {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.025em;
}

.badge-success, .badge.bg-success {
    background: var(--color-success) !important;
    color: white;
}

.badge-warning, .badge.bg-warning {
    background: var(--color-warning) !important;
    color: white;
}

.badge-danger, .badge.bg-danger {
    background: var(--color-error) !important;
    color: white;
}

.badge-info, .badge.bg-info {
    background: var(--color-info) !important;
    color: white;
}

.badge-primary, .badge.bg-primary {
    background: var(--color-primary-500) !important;
    color: white;
}

.badge-secondary, .badge.bg-secondary {
    background: var(--color-secondary-500) !important;
    color: white;
}

/* =========================================
   Spinner Styles
========================================= */
.spinner-blue {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-border);
    border-top: 4px solid var(--color-accent-500);
    border-right: 4px solid var(--color-secondary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =========================================
   Utility Classes
========================================= */
.text-primary {
    color: var(--color-primary-500) !important;
}

.text-secondary {
    color: var(--color-text-secondary) !important;
}

.text-accent {
    color: var(--color-accent-500) !important;
}

.text-success {
    color: var(--color-success) !important;
}

.text-warning {
    color: var(--color-warning) !important;
}

.text-danger, .text-error {
    color: var(--color-error) !important;
}

.text-info {
    color: var(--color-info) !important;
}

.bg-primary-light {
    background: var(--color-bg-primary) !important;
}

.bg-secondary-light {
    background: var(--color-bg-secondary) !important;
}

.border-primary {
    border-color: var(--color-primary-500) !important;
}

.border-accent {
    border-color: var(--color-accent-500) !important;
}

/* =========================================
   Responsive Spacing
========================================= */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-xl {
        max-width: calc(100% - 1rem);
    }

    .table {
        font-size: 0.875rem;
    }

    .card-body {
        padding: 1rem;
    }
}

    .tdbutton:hover {
        background: rgba(239, 68, 68, 0.2);
    }

/* =========================================
   Optional: Edit Button (if needed)
========================================= */
.tebutton {
    background: rgba(34, 197, 94, 0.12);
    color: var(--color-success);
    border-color: rgba(34, 197, 94, 0.25);
}

    .tebutton:hover {
        background: rgba(34, 197, 94, 0.2);
    }

/* =========================================
   Icon inside button
========================================= */
.tbutton i {
    font-size: 13px;
    line-height: 1;
}

/* =========================================
   Group spacing (inside table cell)
========================================= */
.table-actions {
    display: flex;
    gap: 6px;
}

.spinner-blue {
    width: 40px;
    height: 40px;
    position: relative;
}

    /* Main arc */
    .spinner-blue::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 50%;
        border: 3px solid transparent;
        border-top-color: var(--color-primary-500);
        border-right-color: var(--color-accent-500);
        animation: spin 0.8s linear infinite;
    }

    /* Faded trailing arc */
    .spinner-blue::after {
        content: "";
        position: absolute;
        inset: 6px;
        border-radius: 50%;
        border: 2px solid transparent;
        border-top-color: rgba(0, 181, 239, 0.25);
        animation: spin-reverse 1.2s linear infinite;
    }

/* Animations */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes spin-reverse {
    to {
        transform: rotate(-360deg);
    }
}
.animate-fadeup {
    animation-name: fadeUp;
    animation-duration: 300ms;
    animation-timing-function: ease-out;
    animation-fill-mode: both;
    will-change: transform, opacity;
}
@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade-in Animation for Table Rows */
.fade-in-row {
    opacity: 0;
    animation: fadeIn 0.3s ease-in forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0.6;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
