/* Custom CSS for Admin Dashboard */

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

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

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

/* Sidebar scrollbar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 2px;
}

/* Table hover effect */
table tbody tr {
    transition: background-color 0.15s ease;
}

/* Card hover effect */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

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

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

/* Form input focus animation */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Mobile menu animation */
#mobileMenu {
    will-change: transform;
}

#mobileMenu.active {
    transform: translateX(0);
}

#mobileMenuOverlay.active {
    display: block;
    opacity: 1;
}

/* Stats card animation */
.stats-card {
    transition: transform 0.2s ease;
}

.stats-card:hover {
    transform: translateY(-4px);
}

/* Chart container */
.chart-container {
    position: relative;
    min-height: 250px;
}

/* Responsive table */
@media (max-width: 768px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Avatar placeholder */
.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
}

/* Badge animations */
.badge-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Toast notifications position */
.swal2-container {
    z-index: 9999 !important;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    aside,
    header,
    footer {
        display: none !important;
    }

    main {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Sidebar Collapse Styles */
#sidebar.sidebar-collapsed .sidebar-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.2s ease, width 0.2s ease;
    margin: 0;
}

#sidebar:not(.sidebar-collapsed) .sidebar-text {
    opacity: 1;
    width: auto;
    transition: opacity 0.2s ease 0.1s, width 0.2s ease;
}

/* Hide submenu when sidebar is collapsed */
#sidebar.sidebar-collapsed .menu-item-group #dashboard-submenu {
    display: none !important;
}

/* Center icons when sidebar is collapsed */
#sidebar.sidebar-collapsed nav>a,
#sidebar.sidebar-collapsed nav>.menu-item-group>button {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Adjust toggle button position when collapsed */
#sidebar.sidebar-collapsed #sidebarToggle {
    right: -10px;
}

/* Hide user info text when collapsed */
#sidebar.sidebar-collapsed .p-4.border-t .sidebar-text {
    display: none;
}

/* Center user avatar when collapsed */
#sidebar.sidebar-collapsed .p-4.border-t .flex {
    justify-content: center;
}

/* Hover Popup Menu for Collapsed Sidebar */
.collapsed-popup-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -2px;
    background-color: #1e293b;
    border-radius: 8px;
    padding: 8px;
    min-width: 200px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* Show popup on hover when sidebar is collapsed */
#sidebar.sidebar-collapsed .menu-item-group {
    position: relative;
}

#sidebar.sidebar-collapsed .menu-item-group:hover .collapsed-popup-submenu {
    display: block !important;
}

/* Popup menu link styles */
.collapsed-popup-submenu a {
    display: flex !important;
    align-items: center;
    padding: 8px 12px !important;
    margin: 2px 0 !important;
    border-radius: 6px;
    color: #cbd5e1;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.collapsed-popup-submenu a:hover {
    background-color: #334155;
    color: white;
}

.collapsed-popup-submenu a.bg-sidebar-hover {
    background-color: #334155;
    color: white;
}

.collapsed-popup-submenu a i {
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

/* Arrow pointer for popup */
.collapsed-popup-submenu::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 12px;
    border: 6px solid transparent;
    border-right-color: #1e293b;
}

/* Grand Total Row - Sticky at bottom of scrollable tables */
.table-grand-total {
    position: sticky;
    bottom: 0;
    background-color: #DBEAFE;
    /* Blue-50 */
    font-weight: 700;
    border-top: 2px solid #93C5FD;
    /* Blue-300 */
    z-index: 10;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

.table-grand-total td {
    padding: 0.75rem 1rem;
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ============================================
   AUTHENTICATION PAGES - NEW STYLES
   ============================================ */

/* Floating animation for illustration */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Gradient backgrounds for auth pages */
.gradient-auth-left {
    background: linear-gradient(135deg, #3B82F6 0%, #14B8A6 50%, #0D9488 100%);
}

/* Form input focus states */
.auth-input:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Button hover effects */
.auth-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

.auth-button:active {
    transform: translateY(0);
}

/* Card entrance animation */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card {
    animation: slideUp 0.6s ease-out;
}

/* Decorative circles */
.decorative-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Mobile responsive adjustments */
@media (max-width: 1024px) {
    .auth-illustration {
        max-width: 300px;
    }
}

/* Step indicator for forgot password flow */
.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 0.5rem;
}

.step {
    display: flex;
    align-items: center;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E2E8F0;
    color: #64748B;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.step-circle.active {
    background: linear-gradient(135deg, #3B82F6, #14B8A6);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.step-circle.completed {
    background: #14B8A6;
    color: white;
}

.step-line {
    width: 60px;
    height: 2px;
    background: #E2E8F0;
    margin: 0 10px;
    transition: all 0.3s ease;
}

.step-line.active,
.step-line.completed {
    background: linear-gradient(90deg, #3B82F6, #14B8A6);
}

/* Password strength indicator */
.password-strength {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

.password-strength.weak {
    background-color: #FEE2E2;
    color: #DC2626;
}

.password-strength.medium {
    background-color: #FEF3C7;
    color: #D97706;
}

.password-strength.strong {
    background-color: #D1FAE5;
    color: #059669;
}

/* Security question form styling */
.security-question-section {
    background: linear-gradient(to right, #F0F9FF, #ECFDF5);
    border-left: 4px solid #14B8A6;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-top: 1.5rem;
}

/* Auth page alert styles */
.auth-alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: start;
    gap: 0.75rem;
}

.auth-alert.info {
    background-color: #DBEAFE;
    border-left: 4px solid #3B82F6;
    color: #1E40AF;
}

.auth-alert.warning {
    background-color: #FEF3C7;
    border-left: 4px solid #F59E0B;
    color: #92400E;
}

.auth-alert.success {
    background-color: #D1FAE5;
    border-left: 4px solid #10B981;
    color: #065F46;
}

/* Loading spinner for auth buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

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

/* Checkbox custom styling for Remember Me */
input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}

/* Smooth transitions for all auth inputs */
.auth-input,
.auth-select {
    transition: all 0.2s ease;
}

.auth-input:focus,
.auth-select:focus {
    transform: translateY(-1px);
}

/* Link hover effects */
.auth-link {
    position: relative;
    transition: color 0.2s ease;
}

.auth-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: currentColor;
    transition: width 0.3s ease;
}

.auth-link:hover::after {
    width: 100%;
}