:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-width: 260px;
    --header-height: 70px;

    /* Box Colors (Light Mode) */
    --normal-bg: #ffffff;
    --weekend-bg: #ffffff;
    --holiday-bg: #ffffff;
    --event-bg: #fef9c3;

    --holiday-red: #ef4444;
    --event-yellow: #f0d9b2;
    --border-color: #e2e8f0;
}


[data-theme="dark"] {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --normal-bg: #1e293b;
    --weekend-bg: #0f172a;
    --holiday-bg: #450a0a;
    --event-bg: #422006;
    --border-color: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif !important;
    transition: background-color 0.3s, color 0.3s;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    /* Soft light background */
    background-image:
        radial-gradient(at 40% 20%, rgba(132, 94, 236, 0.15) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(220, 38, 38, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 80% 50%, rgba(245, 158, 11, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.5;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    background-image:
        radial-gradient(at 40% 20%, rgba(132, 94, 236, 0.4) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(220, 38, 38, 0.25) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.2) 0px, transparent 50%),
        radial-gradient(at 80% 50%, rgba(245, 158, 11, 0.25) 0px, transparent 50%);
}

.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.auth-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    overflow: hidden;
}

.auth-content {
    padding: 2rem !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
}

.login-page-body {
    overflow: hidden;
}

/* SIDEBAR (Light Theme) */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    flex-shrink: 0;
    z-index: 100;
}

[data-theme="dark"] .sidebar {
    background: rgba(30, 41, 59, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-container {
    position: relative;
    width: 100px;
    height: 48px;
    margin: 0 auto 16px auto;
    /* Reduced bottom margin: pulls tabs up */
    display: grid;
    place-items: center;
}

.logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* No filter — logo already has correct brand colors */
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-btn {
    padding: 0.85rem 1.25rem;
    border-radius: 14px;
    border: none;
    background: transparent;
    text-decoration: none;
    color: #64748b;
    /* Muted slate text */
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    /* Entrance Animation */
    animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.nav-btn:hover {
    background: #f1f5f9;
    color: #4f46e5;
    transform: translateX(4px);
}

.nav-btn.active {
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 700;
}

/* Staggered Animation Delays */
.nav-links .nav-btn:nth-child(1) {
    animation-delay: 0.05s;
}

.nav-links .nav-btn:nth-child(2) {
    animation-delay: 0.10s;
}

.nav-links .nav-btn:nth-child(3) {
    animation-delay: 0.15s;
}

.nav-links .nav-btn:nth-child(4) {
    animation-delay: 0.20s;
}

.nav-links .nav-btn:nth-child(5) {
    animation-delay: 0.25s;
}

.nav-links .nav-btn:nth-child(6) {
    animation-delay: 0.30s;
}

.nav-links .nav-btn:nth-child(7) {
    animation-delay: 0.35s;
}

.nav-links .nav-btn:nth-child(8) {
    animation-delay: 0.40s;
}

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(-15px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-icon {
    width: 20px;
    height: 20px;
    opacity: 0.9;
}

.btn-logout {
    margin-top: auto;
    color: #ef4444 !important;
    /* Bright red for light background */
}

.btn-logout:hover {
    background: #fef2f2 !important;
    /* Pale red background */
    color: #dc2626 !important;
    /* Darker red text on hover */
    transform: translateX(4px);
}

/* MAIN CONTAINER */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* STATIC TOP HEADER */
.static-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
    z-index: 50;
}

[data-theme="dark"] .static-header {
    background: rgba(30, 41, 59, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Premium Header Navigation Buttons (Prev/Next) */
.header-nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.header-nav-btn:hover {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.05);
}

.header-center {
    flex: 0 1 400px;
    position: relative;
}

.search-bar {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 2.8rem;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .search-bar {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.search-bar::placeholder {
    color: #94a3b8;
    /* Softer, premium placeholder color */
}

.search-bar:focus {
    background: #ffffff;
    /* pure white on focus */
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.view-toggles {
    display: flex;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 0.75rem;
}

.view-btn {
    padding: 0.4rem 1rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.view-btn.active {
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary-color);
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* SCROLLABLE CONTENT */
.scrollable-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

/* ── Header Dropdown ── */
.dropdown {
    position: relative;
    display: inline-flex;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 500;
    overflow: hidden;
    animation: dropFade 0.15s ease;
}

[data-theme="dark"] .dropdown-content {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}

@keyframes dropFade {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.15s;
}

.dropdown-content a:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .btn {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn:hover {
    background: #f1f5f9;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
}

/* Calendar Grid (Floating Cards) */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    background: transparent;
    border: none;
    box-shadow: none;
    min-width: 320px;
}

.calendar-wrapper {
    overflow-x: visible;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
}

.day-header {
    background: transparent;
    padding: 10px;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    color: #0f172a;
    text-transform: uppercase;
    font-size: 0.9rem;
    border: none;
    box-shadow: none;
    position: sticky;
    top: -2rem;
    z-index: 20;
}

/* Ensure the first and last headers match the grid's rounded corners */
.day-header:first-child {
    border-radius: 0;
}

.day-header:nth-child(7) {
    border-radius: 0;
}

.day-cell {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    min-height: 120px;
    border-radius: 16px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
}

[data-theme="dark"] .day-cell {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}

.day-cell:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(79, 70, 229, 0.12);
    border-color: #818cf8;
    z-index: 10;
}

.day-cell.weekend,
.day-cell.holiday,
.day-cell.leave-approved {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.day-cell.today {
    background: rgba(79, 70, 229, 0.18);
    /* Stronger faded blue tint */
    border: 2px solid rgba(79, 70, 229, 0.4);
    /* Stronger accent border */
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
    /* Soft glow */
    z-index: 5;
}

.day-number {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: #312e81;
    position: relative;
    z-index: 1;
}

.day-cell.today .day-number {
    color: #312e81;
    /* Deep navy to match other numbers perfectly */
    font-weight: 800;
    font-size: 1.4rem;
}



@keyframes pulseToday {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.day-cell.event-day {
    background: #ffffff !important;
}

.day-cell.half-day {
    background: #ffffff !important;
}

.day-cell.holiday.event-day {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
}

.day-cell.other-month {
    background: #ffffff;
    opacity: 0.4;
}

.day-cell.past-date {
    background: #f8fafc;
    opacity: 0.7;
    cursor: default !important;
}

.day-cell.past-date:hover {
    transform: none;
    box-shadow: none;
    filter: none;
}

.day-number {
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.day-tags-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    flex: 1;
}

.holiday .day-number,
.weekend .day-number,
.leave-approved .day-number {
    color: var(--holiday-red);
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-tag {
    background: #ffffff;
    /* Contrast against the light blue cell */
    color: #4f46e5;
    border: 1px solid #e0e7ff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: normal;
    word-wrap: break-word;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
    display: block;
}

.day-cell.today .event-tag {
    background: #e0e7ff;
    color: #3730a3;
}

.event-tag.holiday-tag {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
}

.event-tag.type-event {
    background: var(--event-yellow);
    color: #000;
}

.event-tag.type-half-day {
    background: #3b82f6;
}

.leave-tag {
    font-size: 0.55rem;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.leave-tag:hover {
    transform: scale(1.1);
    z-index: 10;
}

.leave-tag.status-pending {
    background: #fef9c3;
    color: #a16207;
    border-color: #fde047;
}

.leave-tag.status-approved,
.leave-tag.status-partially_approved {
    background: #dcfce7;
    color: #16a34a;
    border-color: #86efac;
}

.leave-tag.status-partially_approved {
    background: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.leave-tag.status-rejected {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

.birthday-tag {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    background: #f3e8ff;
    color: #7e22ce;
    font-weight: 600;
    border-left: 2px solid #a855f7;
    cursor: default;
    white-space: normal;
    word-wrap: break-word;
}

.meeting-count-badge {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    text-align: center;
    margin-top: auto;
}

.calendar-meeting-item {
    font-size: 0.65rem;
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
    padding: 2px 6px;
    border-radius: 4px;
    border-left: 3px solid #8b5cf6;
    margin-top: 2px;
    white-space: normal;
    word-wrap: break-word;
    font-weight: 500;
}

.calendar-meeting-item strong {
    color: #6d28d9;
}

/* Meeting Dashboard Layout */
.meeting-dashboard-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-top: 2rem;
}

.meeting-list-side {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    position: sticky;
    top: 2rem;
}

[data-theme="dark"] .meeting-list-side {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.meeting-item {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.meeting-item:last-child {
    border-bottom: none;
}

.meeting-item:hover {
    background: var(--bg-color);
}

.meeting-time-large {
    font-size: 1.25rem;
    font-weight: 800;
    color: #8b5cf6;
    margin-bottom: 0.5rem;
}

.meeting-details-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meeting-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.meeting-link-btn:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .meeting-dashboard-container {
        grid-template-columns: 1fr;
    }

    .meeting-list-side {
        position: static;
    }
}

/* Slot Grid (Discrete Boxes) */
.slot-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    margin: 2rem 0;
}

.slot-card {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 0.5rem;
    padding: 1.5rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .slot-card {
    background: rgba(30, 41, 59, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}

.slot-card.booked {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.slot-card:not(.booked):hover {
    border-color: #8b5cf6;
    background: rgba(139, 92, 246, 0.05);
    transform: translateY(-3px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.slot-time {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.booked .slot-time {
    color: #94a3b8;
    text-decoration: line-through;
}

.slot-details {
    min-height: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

.slot-actions {
    width: 100%;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 90%;
    max-width: 550px;
    padding: 1.5rem 2rem;
    border-radius: 1.5rem;
    max-height: 95vh;
    overflow-y: auto;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

[data-theme="dark"] .modal-content {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

@media (max-width: 1200px) {
    .slot-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .slot-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .slot-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 400px) {
    .slot-grid {
        grid-template-columns: 1fr;
    }
}

.day-tags-top {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    z-index: 10;
    max-width: 70%;
}

/* Form Styling */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 1rem;
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Shared UI Components */
.card {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2.5rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    margin: 2rem auto;
}

[data-theme="dark"] .card {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Responsive Grid for Attendance */
.attendance-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.attendance-table-container {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05), inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    overflow: hidden;
    margin-top: 2rem;
    overflow-x: auto;
}

[data-theme="dark"] .attendance-table-container {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Media Queries */
@media (max-width: 900px) {
    .app-layout {
        flex-direction: row !important;
        height: 100vh !important;
        width: 100vw !important;
    }

    .mobile-menu-toggle {
        display: inline-flex !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        height: 100vh !important;
        width: var(--sidebar-width) !important;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 10000 !important;
        background: var(--card-bg) !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15) !important;
        padding: 1.5rem !important;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 9999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .logo-container {
        margin: 0 auto 1.5rem auto !important;
        width: 100px !important;
        height: 48px !important;
        flex-shrink: 0;
    }

    .nav-links {
        flex-direction: column !important;
        gap: 0.5rem !important;
        flex: 1;
    }

    .nav-btn {
        padding: 0.85rem 1.25rem !important;
        font-size: 0.95rem !important;
        white-space: normal !important;
        border-radius: 14px !important;
        gap: 0.75rem !important;
    }

    .btn-logout {
        margin-top: 1.5rem !important;
        flex-shrink: 0;
    }

    .static-header {
        height: auto;
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
        justify-content: space-between;
    }

    .header-center {
        flex: 1 1 100%;
        order: 3;
    }

    .scrollable-content {
        padding: 1rem;
    }

    .attendance-dashboard-grid {
        grid-template-columns: 1fr;
    }
}




@media (max-width: 768px) {
    .container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .day-cell {
        min-height: 100px;
        padding: 0.5rem;
    }

    .day-number {
        font-size: 0.9rem;
    }

    .event-tag,
    .leave-tag,
    .birthday-tag {
        font-size: 0.6rem;
        padding: 0.2rem 0.4rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.25rem;
    }

    /* Disable sticky columns on small screens to allow horizontal scrolling */
    .sticky-col-1,
    .sticky-col-2 {
        position: static !important;
        background: transparent !important;
        backdrop-filter: none !important;
        z-index: auto !important;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.4rem;
    }

    .day-header {
        padding: 0.5rem 0.1rem;
        font-size: 0.6rem;
    }

    .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .dropdown-content {
        right: auto;
        left: 0;
        min-width: 160px;
    }

    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .btn-group-responsive {
        flex-direction: column !important;
    }

    .calendar-grid {
        gap: 0;
    }

    .day-cell {
        min-height: 80px;
        padding: 0.25rem;
    }

    .day-number {
        font-size: 0.8rem;
    }

    .event-tag {
        font-size: 0.55rem;
        padding: 0.15rem 0.25rem;
    }

    .day-tags-top {
        top: 0.25rem;
        right: 0.25rem;
    }

    .leave-tag,
    .birthday-tag {
        font-size: 0.5rem;
        padding: 0.1rem 0.2rem;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.btn-group-responsive {
    display: flex;
    gap: 1rem;
}

/* Navigation Dropdown Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 140px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
    right: 0;
    overflow: hidden;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.dropdown-content a:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
    padding-left: 1.25rem;
}

/* Spreadsheet Layout Responsive Styles */
.spreadsheet-page-content {
    padding: 0 !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

.spreadsheet-header {
    background: white;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    flex-shrink: 0;
}

[data-theme="dark"] .spreadsheet-header {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
}

.spreadsheet-toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .spreadsheet-header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
    }

    .spreadsheet-toolbar {
        justify-content: flex-start;
        gap: 0.4rem;
    }

    .spreadsheet-toolbar .btn {
        flex-grow: 1;
        text-align: center;
        justify-content: center;
    }
}

/* Profiles and Header Right Responsive Adjustments */
@media (max-width: 600px) {
    .profile-text-info {
        display: none !important;
    }

    .user-profile {
        padding: 5px !important;
    }

    /* Responsive Form Grid for Modal */
    .form-grid,
    .modal-grid-responsive {
        grid-template-columns: 1fr !important;
    }
}

.btn-group-responsive {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 480px) {
    .btn-group-responsive {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .btn-group-responsive .btn,
    .btn-group-responsive button {
        width: 100% !important;
        flex: none !important;
    }

    .external-participant-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        border-bottom: 1px dashed var(--border-color);
        padding-bottom: 0.75rem;
        margin-bottom: 0.75rem !important;
    }

    .external-participant-row button {
        align-self: flex-end;
    }
}