@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-green: #1e8731;
    --primary-green-light: #28a745;
    --dark-brown: #0a0909;
    --dark-brown-light: #1a1a1a;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --sidebar-width: 260px;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

/* Global Smooth Transitions */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary-green);
    z-index: 10000;
    transition: width 0.4s ease, opacity 0.4s ease;
    box-shadow: 0 0 10px rgba(30, 135, 49, 0.4);
}

.content-fade-in {
    animation: contentFadeIn 0.5s ease forwards;
}

@keyframes contentFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-content {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.main-content.loading {
    opacity: 0.3;
    pointer-events: none;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 10px;
}

/* Dashboard Layout */
.wrapper {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--dark-brown);
    color: white;
    height: 100vh;
    position: fixed;
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1000;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    will-change: width;
}

.sidebar.active {
    width: 80px;
}

.sidebar.active .sidebar-header h2,
.sidebar.active .sidebar-header .brand-subtitle,
.sidebar.active .brand-text,
.sidebar.active .nav-group-label,
.sidebar.active .sidebar-menu span,
.sidebar.active .logout-btn span {
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0.2s;
}

.sidebar:not(.active) .sidebar-header h2,
.sidebar:not(.active) .sidebar-header .brand-subtitle,
.sidebar:not(.active) .brand-text,
.sidebar:not(.active) .nav-group-label,
.sidebar:not(.active) .sidebar-menu span,
.sidebar:not(.active) .logout-btn span {
    opacity: 1;
    max-width: 200px;
    visibility: visible;
    transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1) 0.06s,
        max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0.28s;
}

.sidebar.active .sidebar-menu a {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.active .sidebar-menu a i {
    margin-right: 0;
    font-size: 1.3rem;
}

.sidebar.active .logout-btn {
    justify-content: center;
    padding: 12px 0;
}

.sidebar.active .logout-btn i {
    margin-right: 0;
    font-size: 1.2rem;
}

.sidebar-header {
    padding: 20px 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 10px;
}

.brand-logo {
    display: flex;
    flex-direction: column;
    /* Move text below logo */
    align-items: center;
    text-align: center;
    gap: 8px;
}

.brand-logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.brand-text h2 {
    font-size: 1.1rem;
    margin: 0;
    color: white;
    /* Visible on dark sidebar */
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
}

.brand-text .brand-subtitle {
    margin: 0;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-toggle-btn {
    position: absolute;
    right: 15px;
    top: 40px;
    /* Moved down from 25px */
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    transition: background-color 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        color 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.32s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}


.sidebar-toggle-btn:hover {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

.sidebar.active .sidebar-header {
    padding: 20px 0;
    align-items: center;
}

.sidebar.active .brand-logo {
    justify-content: center;
}

.sidebar.active .sidebar-toggle-btn {
    position: relative;
    right: 0;
    top: 0;
    margin: 5px 0 0 0;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 10px;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--primary-green);
    color: white;
}

.sidebar-menu a i {
    margin-right: 12px;
    font-size: 1.1rem;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    padding: 0;
    background-color: var(--bg-light);
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.page-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.main-content.collapsed {
    margin-left: 80px;
    width: calc(100% - 80px);
}

/* Navbar */
.navbar {
    height: 70px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 999;
}

.nav-search {
    position: relative;
    width: 300px;
}

.nav-search input {
    width: 100%;
    padding: 9px 12px 9px 40px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    background: #f9fafb;
    font-size: 0.875rem;
    color: #333;
    transition: all 0.2s;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Dashboard Cards */
.content-wrapper {
    padding: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .flex-responsive {
        width: 100%;
        justify-content: stretch;
    }

    .page-header .btn {
        flex: 1;
    }
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-brown);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 26px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-brown);
}

/* Glassmorphism Example */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 20px;
}

/* Tables */
.card-table {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 15px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--dark-brown);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

td {
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-present {
    background: #e6f4ea;
    color: #1e8e3e;
}

.badge-absent {
    background: #fce8e6;
    color: #d93025;
}

.badge-pending {
    background: #fef7e0;
    color: #f9ab00;
}

/* Action Buttons (Tick/Reject) */
.action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    background: #fff;
    position: relative;
    overflow: hidden;
}

.btn-approve {
    color: #2e7d32;
    border-color: #e8f5e9;
}

.btn-approve:hover {
    background: #2e7d32;
    color: #fff;
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.3);
    border-color: #2e7d32;
}

.btn-reject {
    color: #c62828;
    border-color: #ffebee;
}

.btn-reject:hover {
    background: #c62828;
    color: #fff;
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 8px 20px rgba(198, 40, 40, 0.3);
    border-color: #c62828;
}

.action-btn i {
    transition: transform 0.3s ease;
}

.btn-approve:hover i {
    animation: tickPulse 0.5s ease-in-out;
}

.btn-reject:hover i {
    animation: crossShake 0.4s ease-in-out;
}

@keyframes tickPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes crossShake {

    0%,
    100% {
        transform: translateX(0) rotate(0);
    }

    25% {
        transform: translateX(-2px) rotate(-10deg);
    }

    75% {
        transform: translateX(2px) rotate(10deg);
    }
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-green);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-green-light);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary-green);
    color: var(--primary-green);
}

.btn-outline:hover {
    background: var(--primary-green);
    color: white !important;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: all 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-brown);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    background: #f9fafb;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    white-space: nowrap;
    /* Prevent asterisk from wrapping */
}

.form-input {
    width: 100%;
    padding: 12px 15px;
    border: 1.5px solid #eee;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

.form-input:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 4px rgba(30, 135, 49, 0.1);
}

/* Toast Notifications */
.toast {
    background: white;
    padding: 15px 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    border-left: 5px solid var(--primary-green);
    animation: slideInRight 0.3s ease;
}

.toast-error {
    border-left-color: #d63031;
}

.toast i {
    font-size: 1.2rem;
}

.toast-success i {
    color: var(--primary-green);
}

.toast-error i {
    color: #d63031;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Utilities */
.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.flex-responsive {
    display: flex;
    gap: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 80px;
    }

    .sidebar-header h2,
    .sidebar-header .brand-subtitle,
    .sidebar-menu span,
    .logout-btn span {
        display: none;
    }

    .main-content {
        margin-left: 80px;
        width: calc(100% - 80px);
    }

    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-search {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        left: -260px;
        width: var(--sidebar-width) !important;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar.mobile-active {
        left: 0 !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .top-nav,
    .navbar {
        left: 0 !important;
        width: 100% !important;
    }

    .sidebar-header h2,
    .sidebar-header .brand-subtitle,
    .sidebar-menu span,
    .logout-btn span {
        display: inline-block;
    }

    .nav-search {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .page-header .btn {
        width: 100%;
        margin-bottom: 5px;
    }

    .flex-responsive {
        flex-direction: column;
        align-items: stretch;
    }

    /* Stats grid mobile fix - Only for very small screens */
    @media (max-width: 576px) {

        .stats-grid,
        .grid-2,
        .grid-3,
        .grid-4 {
            grid-template-columns: 1fr !important;
        }
    }

    .mobile-toggle {
        display: block !important;
        margin-right: 15px;
    }

    .navbar {
        padding: 0 15px;
    }

    .nav-search {
        display: none;
        /* Hide search on mobile header to save space */
    }

    .nav-attendance {
        margin-right: 10px;
    }

    .btn-attendance span:not(.timer-val) {
        display: none;
        /* Hide "CLOCK IN/OUT" text, keep icon and timer */
    }

    .user-info {
        display: none;
        /* Hide name on mobile header */
    }

    /* New: Hide Team Chat text on mobile */
    .nav-chat-text {
        display: none;
    }

    .nav-chat-link {
        padding: 10px !important;
        margin-right: 8px !important;
        border-radius: 50% !important;
        width: 42px;
        height: 42px;
        justify-content: center;
        gap: 0 !important;
    }

    .btn-attendance {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
    }
}

@media (max-width: 480px) {
    .content-wrapper {
        padding: 15px;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: 15px;
    }
}

/* Global Description Cell (Clamping) */
.description-cell {
    display: block;
    /* Ensure it's a block */
    display: -webkit-box;
    max-width: 250px;
    width: 250px;
    /* Force a width to help clamping */
    font-size: 0.85rem;
    color: #666;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s;
}

.description-cell:hover {
    color: var(--primary-green);
    text-decoration: underline;
}

/* Filter Section Improvements */
.filters-section {
    margin-bottom: 25px;
    padding: 25px;
    border-radius: 15px;
}

.filter-flex {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.filter-btn-group {
    margin-bottom: 0;
}

.filter-btn {
    height: 46px;
    padding: 0 30px;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .filter-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .filter-flex .flex-1 {
        width: 100%;
    }

    .filter-btn {
        width: 100%;
    }
}