/* Asana-Style Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fafbfc;
    color: #2d3748;
}

/* Navbar */
.navbar {
    background: white;
    border-bottom: 1px solid #e6ebf1;
    padding: 0 24px;
    height: 64px;
    box-shadow: none;
}

.navbar-brand {
    color: #2d3748;
    font-weight: 600;
    font-size: 1.25rem;
}

/* Sidebar */
.sidebar {
    background: white;
    height: calc(100vh - 64px);
    width: 220px;
    padding: 16px 0;
    border-right: 1px solid #e6ebf1;
    position: fixed; /* fixed with its own vertical scroll */
    left: 0;
    top: 64px;
    overflow-y: auto; /* vertical scroll when menu is long */
    transition: width 0.2s ease, transform 0.3s ease;
    z-index: 1050;
}

/* Remove z-index from sidebar when modal is open */
body.modal-open .sidebar,
body:has(.modal.show) .sidebar,
body:has(.modal-backdrop) .sidebar {
    z-index: auto !important;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-item:hover {
    background: #f7fafc;
    border-left-color: #8b70d0;
    color: #8b70d0;
    text-decoration: none;
}

.sidebar-item.active {
    background: #f7fafc;
    border-left-color: #8b70d0;
    color: #8b70d0;
    font-weight: 600;
}

.sidebar-item i {
    width: 20px;
    margin-right: 12px;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar hr {
    margin: 8px 0;
    border-top: 1px solid #e6ebf1;
}

/* Sidebar Groups (Collapsible) */
.sidebar-group {
    margin-bottom: 4px;
}

.sidebar-group-header {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: #2d3748;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    user-select: none;
    background: #e6ebf1;
}

.sidebar-group-header:hover {
    background: #d1d9e6;
    color: #8b70d0;
}

.sidebar-group-header i:first-child {
    width: 20px;
    margin-right: 12px;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-group-icon {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.2s;
}

.sidebar-group.expanded .sidebar-group-icon {
    transform: rotate(180deg);
}

.sidebar-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
}

.sidebar-group.expanded .sidebar-group-items {
    max-height: 1000px;
}

/* Only style items that are direct children of sidebar-group-items */
.sidebar-group .sidebar-group-items > .sidebar-item {
    padding-left: 24px;
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 10px;
    font-weight: 500;
    color: #718096;
}

.sidebar-group .sidebar-group-items > .sidebar-item span {
    font-size: 10px;
}

.sidebar-group .sidebar-group-items > .sidebar-item i {
    width: 14px;
    margin-right: 8px;
    font-size: 12px;
    flex-shrink: 0;
}

.sidebar-group .sidebar-group-items > .sidebar-item:hover {
    background: #f7fafc;
    color: #8b70d0;
    border-left-color: #8b70d0;
}

/* Ensure standalone items (direct children of sidebar) maintain proper styling */
.sidebar > .sidebar-item {
    padding-left: 24px;
}


/* Main Content */
.main-content {
    margin-left: 220px;
    padding: 32px;
    background: #fafbfc;
    min-height: calc(100vh - 64px);
    transition: margin-left 0.2s ease;
}

/* Collapsed sidebar - overflow visible so flyout can show to the right of the nav */
.sidebar.collapsed {
    width: 60px;
    overflow: visible;
}

.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
}

.sidebar.collapsed .sidebar-item i {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-item span {
    display: none;
}

/* Parent menu items (group headers) when sidebar collapsed - center icon, hide text and chevron */
.sidebar.collapsed .sidebar-group-header {
    padding: 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-group-header span {
    display: none;
}

.sidebar.collapsed .sidebar-group-header i:first-child {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-group-icon {
    display: none;
}

/* When collapsed: show child items in a flyout on hover over parent (both admin and user dashboard) */
.sidebar.collapsed .sidebar-group {
    position: relative;
}

/* Flyout: to the right of sidebar border (sidebar is 60px), so left: 60px from group = right of nav */
.sidebar.collapsed .sidebar-group-items {
    position: absolute;
    left: 60px;
    top: 0;
    min-width: 200px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
    box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    padding: 8px 0;
    z-index: 1200;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0.15s, opacity 0.15s;
    border: 1px solid #e6ebf1;
}

/* Show flyout on parent header hover or when hovering the flyout itself (so it stays visible while clicking a child) */
.sidebar.collapsed .sidebar-group-header:hover ~ .sidebar-group-items,
.sidebar.collapsed .sidebar-group-items:hover {
    visibility: visible;
    opacity: 1;
}

/* Child items inside flyout: full style (icon + text), clickable */
.sidebar.collapsed .sidebar-group .sidebar-group-items > .sidebar-item {
    padding: 8px 16px;
    padding-left: 16px;
    justify-content: flex-start;
    min-height: 36px;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-group .sidebar-group-items > .sidebar-item span {
    display: inline;
}

.sidebar.collapsed .sidebar-group .sidebar-group-items > .sidebar-item i {
    margin-right: 8px;
    width: 18px;
    font-size: 14px;
}

.sidebar.collapsed + .main-content,
body.sidebar-collapsed .main-content {
    margin-left: 60px;
}

/* Dashboard Stats */
.stats-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    border: 1px solid #e6ebf1;
    transition: all 0.2s;
    height: 100%;
}

.stats-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
    border-color: #d1d9e6;
}

.stats-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: white;
}

.stats-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin: 8px 0;
    color: #2d3748;
}

.stats-card p {
    color: #718096;
    margin: 0;
    font-size: 14px;
}

/* Asana Color Scheme */
.bg-asana-purple { background: #8b70d0; }
.bg-asana-green { background: #1aac4c; }
.bg-asana-yellow { background: #ffaa00; }
.bg-asana-blue { background: #2563eb; }
.bg-asana-red { background: #ff4337; }

/* Tables */
.table-container {
    padding-bottom: 36px;
    background: white;
    border-radius: 8px;
    padding: 24px;
    border: 1px solid #e6ebf1;
}

/* Extra bottom padding for better spacing below tables */
.table-container {
    padding-bottom: 36px;
}

.table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table thead {
    background: #fafbfc;
}

.table thead th {
    border-bottom: 2px solid #e6ebf1;
    padding: 10px 8px;
    font-weight: 600;
    color: #4a5568;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fafbfc;
}

.table tbody td {
    padding: 12px 8px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}

.table tbody tr:hover {
    background: #fafbfc;
}

/* Forms - Login Page Specific */
.auth-page {
    min-height: 100vh;
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: white;
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e6ebf1;
}

.auth-card h2 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 24px;
}

.auth-card .subtitle {
    color: #718096;
    font-size: 14px;
    margin-bottom: 32px;
}

.form-label {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-control {
    border: 1px solid #d1d9e6;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s;
    font-size: 15px;
}

.form-control:focus {
    border-color: #8b70d0;
    box-shadow: 0 0 0 3px rgba(139, 112, 208, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: #a0aec0;
}

/* Buttons */
.btn {
    border-radius: 6px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #8b70d0;
    color: white;
}

.btn-primary:hover {
    background: #755db8;
    color: white;
}

.btn-success {
    background: #1aac4c;
    color: white;
}

.btn-warning {
    background: #ffaa00;
    color: white;
}

.btn-danger {
    background: #ff4337;
    color: white;
}

.btn-info {
    background: #2563eb;
    color: white;
}

.btn-outline-secondary {
    background: white;
    border: 1px solid #d1d9e6;
    color: #4a5568;
}

.btn-outline-secondary:hover {
    background: #fafbfc;
    color: #2d3748;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 15px;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bg-success { background: #1aac4c; color: white; }
.bg-warning { background: #ffaa00; color: white; }
.bg-danger { background: #ff4337; color: white; }
.bg-info { background: #2563eb; color: white; }
.bg-secondary { background: #718096; color: white; }

/* Homepage */
.hero-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.hero-card {
    background: white;
    border-radius: 12px;
    padding: 48px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.hero-card img {
    max-width: 100px;
    margin-bottom: 24px;
}

.hero-card h1 {
    color: #2d3748;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 32px;
}

.hero-card p {
    color: #718096;
    margin-bottom: 32px;
    font-size: 15px;
}

.hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Instructions */
.instruction-item {
    padding: 16px;
    margin-bottom: 12px;
    background: #fafbfc;
    border-left: 3px solid #8b70d0;
    border-radius: 6px;
}

.instruction-item strong {
    color: #2d3748;
    display: block;
    margin-bottom: 4px;
}

.instruction-item p {
    color: #718096;
    margin: 0;
    font-size: 14px;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e6ebf1;
    overflow: hidden;
}

.card-body {
    padding: 24px;
}

.card-title {
    color: #2d3748;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%) !important;
        width: 220px !important;
        box-shadow: 2px 0 8px rgba(0,0,0,0.1);
        transition: transform 0.3s ease !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .sidebar.show {
        transform: translateX(0) !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Remove collapsed state on mobile */
    .sidebar.collapsed {
        width: 220px !important;
    }
    
    .sidebar.collapsed .sidebar-item span {
        display: block !important;
    }
    
    .sidebar.collapsed .sidebar-item {
        justify-content: flex-start !important;
    }
    
    .sidebar.collapsed .sidebar-item i {
        margin-right: 12px !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 16px;
    }
    
    body.sidebar-collapsed .main-content {
        margin-left: 0 !important;
    }
    
    .auth-card {
        padding: 32px 24px;
    }
    
    /* Overlay when sidebar is open on mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

/* DataTables Custom Styling */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    margin: 0 8px 8px 0;
}

/* Left align the length control, right align the search bar */
.dataTables_wrapper .dataTables_length { float: left; }
.dataTables_wrapper .dataTables_filter { float: right; text-align: right; }

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #d1d9e6;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    height: 28px;
}

.dataTables_wrapper .dataTables_length select {
    width: auto;
    min-width: 80px;
}

.dataTables_wrapper .dataTables_filter input {
    width: 180px;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #8b70d0;
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 112, 208, 0.1);
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: 6px;
    float: right;
    text-align: right;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border: 1px solid #e6ebf1;
    border-radius: 6px;
    padding: 2px 8px;
    margin: 0 2px;
    transition: all 0.2s;
    font-size: 12px;
}

/* Bootstrap 5 pagination used by DataTables */
.dataTables_wrapper .dataTables_paginate ul.pagination { margin: 0; }
.dataTables_wrapper .dataTables_paginate .page-item .page-link {
    padding: 2px 8px;
    font-size: 12px;
    line-height: 1.2;
}
.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    opacity: 0.6;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f7fafc;
    border-color: #8b70d0;
    color: #8b70d0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #8b70d0 !important;
    border-color: #8b70d0 !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_info {
    color: #718096;
    font-size: 12px;
    float: left;
}

.dataTables_wrapper .dataTables_processing {
    border: 1px solid #e6ebf1;
    background: white;
    color: #2d3748;
    border-radius: 8px;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}