/* Custom styles for Air Selangor Theme */

:root {
    /* Air Selangor Brand Colors */
    --primary-blue: #003B70;
    /* Deep Corporate Blue */
    --accent-cyan: #00A3E0;
    /* Water Cyan */
    --accent-green: #66CC00;
    /* Eco Green */

    /* Light Theme Glass */
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 59, 112, 0.1);
    --sidebar-width: 17rem;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #F8FAFC;
    /* Slate 50 */
    color: #1e293b;
    /* Slate 800 */
}

/* Sidebar Styles */
#sidebar {
    background: linear-gradient(180deg, var(--primary-blue) 0%, #00284d 100%);
    box-shadow: 4px 0 24px rgba(0, 59, 112, 0.15);
}

/* Better Table Styling */
tr {
    transition: all 0.2s ease;
}

tr:hover td {
    background-color: #f1f5f9;
    /* Slate 100 */
}

.nav-item {
    position: relative;
    color: #94a3b8;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--accent-cyan);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.nav-item:hover {
    color: #ffffff;
}

/* Submenu Styles */
.submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    opacity: 0;
    display: block !important;
    /* Override Tailwind's hidden class */
}

.submenu.show {
    max-height: 200px;
    opacity: 1;
}

.submenu-item {
    color: #64748b;
}

.submenu-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
}

.submenu-item:hover {
    color: #cbd5e1;
}

/* Chevron rotation */
#settings-chevron.rotate {
    transform: rotate(180deg);
}

/* Mobile Sidebar */
@media (max-width: 768px) {
    #sidebar.show {
        transform: translateX(0);
    }
}

/* Glassmorphism Effect */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* Custom Checkbox/Toggle styling */
.status-toggle {
    appearance: none;
    width: 3.5rem;
    height: 1.75rem;
    background: #334155;
    border-radius: 99px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.status-toggle::after {
    content: '❌';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.5rem;
    height: 1.5rem;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-toggle:checked {
    background: #10b981;
}

.status-toggle:checked::after {
    content: '✅';
    left: calc(100% - 1.5rem - 2px);
    transform: rotate(360deg);
}

/* Modern Select & Input Styling */
select,
input[type="text"],
input[type="email"] {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    transition: all 0.2s ease;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 3px rgba(0, 163, 224, 0.15);
    background-color: #ffffff;
}

/* Row highlighting */
.present-row {
    background-color: rgba(102, 204, 0, 0.1);
    /* Light Green Tint */
}

.absent-row {
    background-color: rgba(244, 63, 94, 0.1);
    /* Light Red Tint */
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.animate-card {
    animation: slideUp 0.4s ease forwards;
}

/* Mobile reason transition */
.reason-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, margin 0.3s ease;
}

.reason-container.show {
    max-height: 200px;
    margin-top: 1rem;
}

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

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Profile Picture Styles */
.profile-img-container {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f1f5f9;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
}

.profile-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-img-sm {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

/* Image Upload Preview */
#img-preview-container {
    width: 120px;
    height: 120px;
    border-radius: 1.5rem;
    overflow: hidden;
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
}

#img-preview-container.has-image {
    border-style: solid;
    border-color: var(--accent-cyan);
}

#img-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#remove-img-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(244, 63, 94, 0.9);
    color: white;
    padding: 0.25rem;
    border-radius: 0.5rem;
    display: none;
    transition: all 0.2s ease;
}

#img-preview-container.has-image #remove-img-btn {
    display: block;
}

#remove-img-btn:hover {
    background-color: #e11d48;
    transform: scale(1.1);
}

/* Report Profile Section */
.report-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: #f8fafc;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.report-profile-img {
    width: 80px;
    height: 80px;
    border-radius: 1rem;
    border: 3px solid white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    object-fit: cover;
}

.report-profile-info h4 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary-blue);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.report-profile-info p {
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Print Styles Modernization */
@media print {
    @page {
        margin: 1cm;
        size: A4 portrait;
    }

    body {
        background: white !important;
        color: #1e293b !important;
        font-size: 10pt;
    }

    /* Hide UI Elements */
    aside,
    #mobile-menu-toggle,
    #view-dashboard,
    #view-employees,
    #view-holidays,
    .bg-white.p-6.md\:p-8.rounded-3xl.border,
    #save-btn,
    #save-order-btn,
    .print\:hidden,
    #toast,
    header:not(.print\:block) {
        display: none !important;
    }

    /* Reset Container */
    main {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .max-w-7xl {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Keep relevant views visible */
    #view-reports,
    #report-results {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        visibility: visible !important;
    }

    .report-profile-header {
        background-color: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Professional Table for Print */
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }

    th {
        background-color: #003B70 !important;
        color: white !important;
        border-bottom: 2px solid #00284d !important;
        text-transform: uppercase;
        font-size: 8pt;
        padding: 8pt 4pt !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    td {
        border-bottom: 1px solid #e2e8f0 !important;
        padding: 6pt 4pt !important;
        vertical-align: middle;
        font-size: 8pt;
    }

    /* Container Centering & Sizing */
    #report-results {
        max-width: 190mm !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    /* Grid Layout for Stats + Chart */
    .report-summary-consolidated {
        display: grid !important;
        grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
        gap: 12pt !important;
        margin-bottom: 24pt !important;
        page-break-inside: avoid !important;
        width: 100% !important;
    }

    .lg\:col-span-5 {
        grid-column: span 5 / span 5 !important;
    }

    .lg\:col-span-7 {
        grid-column: span 7 / span 7 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Compact Cards in Print */
    .bg-white.p-3.rounded-xl {
        padding: 8pt !important;
        border: 1px solid #e2e8f0 !important;
    }

    #stat-total-days,
    #stat-present,
    #stat-absent,
    #stat-rate {
        font-size: 14pt !important;
        line-height: 1 !important;
    }

    /* Analysis Box Print */
    #report-analysis-container>div {
        background-color: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        padding: 10pt !important;
        height: auto !important;
    }

    canvas {
        max-width: 100% !important;
        height: 180px !important;
        /* Fixed height for consistency in 2-col */
        margin: 0 auto !important;
        display: block !important;
    }

    .bg-white.p-4.rounded-2xl.border:has(canvas) {
        page-break-after: auto !important;
        /* Allow table on same page if space */
        margin-bottom: 24pt !important;
        padding: 10pt !important;
    }

    /* Table Density */
    th {
        padding: 6pt 4pt !important;
        font-size: 7.5pt !important;
    }

    td {
        padding: 4pt 4pt !important;
        font-size: 7.5pt !important;
    }

    /* Signature Compactness */
    .signature-box {
        margin-top: 24pt !important;
        page-break-inside: avoid;
    }
}

/* Activity Feed Styles */
.activity-feed-container {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid #e2e8f0;
}

.activity-item:last-child {
    padding-bottom: 0;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
    border: 2px solid white;
}

.activity-item.present::before {
    background: #10b981;
}

.activity-item.absent::before {
    background: #f43f5e;
}

/* Batch Action Styling */
.batch-actions-bar {
    display: none;
    animation: slideDown 0.3s ease forwards;
}

.batch-actions-bar.show {
    display: flex;
}

/* Global Date Picker */
#global-date-picker {
    cursor: pointer;
}

/* Filter Buttons */
.filter-btn.active {
    background-color: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
}

/* Hero Slider Styles */
#hero-display-container {
    animation: fadeInScale 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.hero-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
}

.hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
}

.hero-dot.active {
    width: 24px;
    background: white;
}

/* Admin Hero Grid */
#hero-images-grid {
    transition: all 0.3s ease;
}

.hero-preview-item {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    height: 120px;
    border: 2px solid white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    animation: fadeInScale 0.3s ease;
}

.hero-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-hero-img-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: rgba(244, 63, 94, 0.9);
    color: white;
    padding: 0.25rem;
    border-radius: 0.5rem;
    opacity: 0;
    transition: all 0.2s ease;
}

.hero-preview-item:hover .remove-hero-img-btn {
    opacity: 1;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }

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