/* Global Font */
body {
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* Custom Scrollbar for Sidebar */
.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Standardizing Syncfusion Grid Global Style */
.e-grid {
    border: none !important;
    font-family: 'Inter', sans-serif !important;
}

.e-grid .e-headercell {
    background-color: transparent !important;
    border-bottom: 2px solid #f8fafc !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

.e-grid .e-headertext {
    font-size: 11px !important;
    font-weight: bold !important;
    color: #334155 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
}

.e-grid .e-rowcell {
    border-bottom: 1px solid #f1f5f9 !important;
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
    color: #7f8b9cff !important;
    font-weight: 600 !important;
    font-size: 13px !important;
}

/* Dedicated Class for Add/Registration Page Grids */
.add-page-grid.e-grid {
    border: none !important;
    background-color: transparent !important;
}

.add-page-grid .e-gridheader {
    border-bottom: none !important;
    background-color: transparent !important;
}

.add-page-grid .e-headercell {
    background-color: #f8fafc !important;
    border-bottom: 2px solid #e2e8f0 !important;
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

.add-page-grid .e-headertext {
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #64748b !important;
    /* Slate-500 */
    text-transform: uppercase !important;
    letter-spacing: 0.15em !important;
}

.add-page-grid .e-rowcell {
    overflow: visible !important;
    border-bottom: 1px solid #f1f5f9 !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    color: #0f172a !important;
    /* Slate-900 */
    font-weight: 600 !important;
    font-size: 13px !important;
}

.grid-header-premium .e-headertext {
    color: #4f46e5 !important;
}

/* Custom Input Styling to match Tailwind */
.custom-input.e-control-wrapper {
    border-radius: 0.75rem !important;
    /* rounded-xl */
    background-color: #f8fafc !important;
    /* bg-slate-50 */
    border: 1px solid #e2e8f0 !important;
    padding: 4px 8px !important;
}

.custom-input.e-control-wrapper.e-input-focus {
    border-color: #6366f1 !important;
    /* indigo-500 */
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1) !important;
}

/* Tabular Figures for Numbers */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Premium Animations */
@keyframes progress-sweep {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(100%);
    }
}

.animate-progress-sweep {
    animation: progress-sweep 2s infinite ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

.animate-shake {
    animation: shake 0.4s ease-in-out;
}

/* Toast/Modal Transitions (mirrors tailwindcss-animate) */
.animate-in {
    animation-duration: 300ms;
    animation-fill-mode: both;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation-name: fade-in;
}

@keyframes zoom-in {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.zoom-in-95 {
    animation-name: zoom-in;
}

@keyframes slide-in-from-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in-from-right-4 {
    animation-name: slide-in-from-right;
}

@keyframes slide-in-from-bottom {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-in-from-bottom-4 {
    animation-name: slide-in-from-bottom;
}

.input-error-highlight {
    border-color: #f43f5e !important;
    /* rose-500 */
    box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.1) !important;
}

/* Global Summary Bar Standardized Styles */
.summary-bar-card {
    background-color: rgba(15, 23, 42, 0.9);
    /* slate-900/90 */
    backdrop-filter: blur(24px);
    border-radius: 1.5rem;
    /* rounded-3xl */
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 1rem 1.25rem;
    position: relative;
    overflow: visible !important;
}

.summary-items-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    /* Reduced from 1.5rem */
    width: 100%;
}

@media (min-width: 1024px) {
    .summary-items-container {
        gap: 1.5rem;
        /* Reduced from 3rem */
    }
}

.summary-item-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.summary-item-label {
    font-size: 8px;
    /* Reduced from 9px */
    font-weight: 900;
    /* font-black */
    color: white;
    /* text-slate-400 */
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.25rem;
    white-space: nowrap;
}

.summary-item-value {
    font-size: 0.875rem;
    /* Reduced from 1rem */
    font-weight: 900;
    color: white;
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    white-space: nowrap;
}

@media (min-width: 1024px) {
    .summary-item-value {
        font-size: 1rem;
        /* Reduced from 1.125rem */
    }
}

.summary-item-value-emerald {
    color: #10b981;
    /* text-emerald-500 */
}

.summary-item-value-amber {
    color: #f59e0b;
    /* text-amber-500 */
}

.summary-item-value-indigo {
    color: #818cf8;
    /* text-indigo-400 */
}

.summary-item-subtext {
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
}

.summary-divider {
    height: 3rem;
    width: 1px;
    background-color: rgba(255, 255, 255, 0.1);
    display: none;
}

@media (min-width: 768px) {
    .summary-divider {
        display: block;
    }
}

/* Premium Input Styling */
.input-premium,
.input-standard {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid rgba(208, 222, 240, 0.6);
    background-color: #f8fafc;
    font-size: 14px;
    font-weight: 500;
    padding: 0.75rem 1rem;
    min-height: 45px;
    outline: none;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.input-premium:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background-color: #ffffff;
}

.input-premium::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

/* Standardized Button System */
.btn-premium {
    height: 45px !important;
    min-height: 45px !important;
    padding: 0 1.5rem !important;
    border-radius: 0.75rem !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    border: none !important;
    white-space: nowrap !important;
}

.btn-primary {
    background-color: #1e3a8a !important;
    /* Blue-900 */
    color: white !important;
    box-shadow: 0 10px 15px -3px rgba(30, 58, 138, 0.2) !important;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1e40af !important;
    /* Blue-800 */
    transform: translateY(-1px) !important;
    box-shadow: 0 20px 25px -5px rgba(30, 58, 138, 0.3) !important;
}

.btn-secondary {
    background-color: transparent !important;
    color: #64748b !important;
    /* Slate-500 */
    border: 1px solid #e2e8f0 !important;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #f8fafc !important;
    color: #1e293b !important;
}

.btn-danger {
    background-color: #ef4444 !important;
    /* Rose-500 */
    color: white !important;
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.2) !important;
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626 !important;
    transform: translateY(-1px) !important;
}

.btn-premium:active:not(:disabled) {
    transform: scale(0.95) !important;
}

.btn-premium:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Standardized Grid Overflow: Auto-scrolling for Reports, Visible for Forms */
.e-grid .e-gridcontent {
    overflow-x: auto !important;
    overflow-y: visible !important;
    /* Allow vertical pop-outs if possible */
}

/* Force visible for registration forms (Add Pages) where pop-out dropdowns are critical */
.add-page-grid .e-gridcontent,
.add-page-grid .e-content,
.add-page-grid .e-table,
.add-page-grid .e-gridheader,
.add-page-grid .e-headercontent,
.add-page-grid .e-rowcell,
.add-page-grid .e-row,
.erp-grid-standard .e-gridcontent,
.erp-grid-standard .e-content,
.erp-grid-standard .e-table,
.erp-grid-standard .e-gridheader,
.erp-grid-standard .e-headercontent,
.erp-grid-standard .e-rowcell,
.erp-grid-standard .e-row {
    overflow: visible !important;
}

.add-page-grid .e-rowcell,
.custom-modern-grid .e-rowcell,
.erp-grid-standard .e-rowcell {
    position: relative;
    z-index: auto;
}

.add-page-grid .e-row:hover .e-rowcell,
.custom-modern-grid .e-row:hover .e-rowcell,
.erp-grid-standard .e-row:hover .e-rowcell {
    z-index: 50 !important;
}

.add-page-grid .e-row:focus-within,
.custom-modern-grid .e-row:focus-within,
.erp-grid-standard .e-row:focus-within {
    z-index: 500 !important;
}

.add-page-grid .e-gridcontent .e-table,
.custom-modern-grid .e-gridcontent .e-table {
    border-collapse: separate;
    border-spacing: 0;
}

/* --- STANDARD CREATION PAGE SYSTEM --- */

/* 1. Main Container (The Glass Card) */
.creation-card {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(24px);
    border-radius: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(226, 232, 240, 0.5);
    padding: 2rem;
    position: relative;
    z-index: 10;
    overflow: visible !important;
    transition: z-index 0s;
}

.creation-card:focus-within {
    z-index: 300 !important;
}

/* Force overflow visible on layout wrappers to prevent clipping, but EXCLUDE scrollable lists */
.creation-card,
.creation-grid-3, 
.creation-grid-4, 
[class*="creation-grid-"],
.flex.flex-col.group,
.date-picker-container,
.searchable-select-container,
.bg-slate-50\/80,
[class*="backdrop-blur"] {
    overflow: visible !important;
}

/* BIG FIX: Elevate the entire card when a dropdown is open so it overlaps the next card */
.creation-card:has(.z-\[99999\]) {
    z-index: 500 !important;
    position: relative;
}

/* Restore scrolling for the actual lists inside dropdowns */
.searchable-select-container div[class*="max-h-"],
.date-picker-popover,
.custom-scrollbar {
    overflow-y: auto !important;
}

/* Ensure Syncfusion popups also remain visible */
.e-dropdownbase {
    overflow: visible !important;
}

@media (min-width: 1024px) {
    .creation-card {
        padding: 2.5rem;
        /* lg:p-10 */
    }
}

/* 2. Step Indicator (The Indigo Circle) */
.creation-step-badge {
    width: 2.5rem;
    height: 2.5rem;
    background-color: #4f46e5;
    /* indigo-600 */
    color: white;
    border-radius: 1rem;
    /* rounded-2xl */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 10px 15px -3px rgba(165, 180, 252, 0.5);
    box-shadow: 0 0 0 4px #eef2ff;
    /* ring-4 ring-indigo-50 */
}

/* 3. Section Title Group */
.creation-header-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.creation-title {
    font-size: 25px;
    font-weight: 600;
    color: #0f172a;
    /* slate-900 */
    letter-spacing: -0.025em;
    /* tracking-tight */
    line-height: 1;
}

/* 4. Form Labels */
.creation-label {
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 500;
    color: #64748b;
    /* slate-500 */
    letter-spacing: 0.05rem;
    /* tracking-widest */
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    margin-left: 0.25rem;
    display: inline-block;
}

.creation-label .required-star {
    color: #ef4444;
    /* red-500 */
    font-weight: bold;
}

/* 5. Responsive Grids */
.creation-grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .creation-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .creation-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.creation-grid-4 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .creation-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .creation-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- UTILITIES --- */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #e2e8f0; /* slate-200 */
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1; /* slate-300 */
}

/* For Firefox */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

/* Mobile Breakpoints */
@media (max-width: 640px) {
    .mobile-small {
        padding: 0.5rem;
    }
}

/* Hamburger Menu Animation */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
}

.hamburger-menu span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: currentColor;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    transition: opacity 0.3s ease-in-out;
}