* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.login-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
}

/* Navbar */
.navbar {
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.nav-brand h2 {
    font-size: 1.5rem;
    color: var(--primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.role-badge {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    text-transform: uppercase;
    font-weight: 600;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 250px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    overflow-y: auto;
}

.menu {
    list-style: none;
}

.menu-item {
    padding: 0.875rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
    font-weight: 500;
}

.menu-item:hover {
    background: var(--background);
    color: var(--primary);
}

.menu-item.active {
    background: var(--primary);
    color: white;
}

.menu-item .icon {
    font-size: 1.25rem;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    margin-top: 70px;
    padding: 2rem;
    min-height: calc(100vh - 70px);
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.875rem;
    color: var(--text);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 12px;
}

.stat-content h3 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Tables */
.table-container {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--primary);
    color: white;
}

th, td {
    padding: 1rem;
    text-align: left;
}

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

tbody tr:hover {
    background: var(--background);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.hunt-select {
    max-width: 400px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
}

.close {
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.modal-content form {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Parties */
.parties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.party-card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.party-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.party-card-title h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.party-card-actions {
    display: flex;
    gap: 0.5rem;
}

.party-members {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.party-member {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--background);
    border-radius: 8px;
}

.party-member-position {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Checkbox Group */
.checkbox-group {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.leader-included {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.leader-included input[type="checkbox"] {
    background: var(--primary);
    border-color: var(--primary);
}

/* Checklist */
.checklist-grid {
    display: grid;
    gap: 1rem;
}

.checklist-item {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.checklist-item:hover {
    border-color: var(--primary);
}

.checklist-item.attended {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.checklist-checkbox {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.checklist-item.attended .checklist-checkbox {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

/* Utilities */
.text-muted {
    color: var(--text-muted);
}

.error-message {
    color: var(--danger);
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    display: none;
}

.error-message.show {
    display: block;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success);
    color: white;
}

body:not(.admin-role) .admin-only {
    display: none !important;
}

body:not(.team-leader-role) .team-leader-only {
    display: none !important;
}

body.team-leader-role .admin-only {
    display: none !important;
}

/* Ensure weekly checklist is visible for team leaders */
body.team-leader-role #weeklyChecklistSection {
    display: block !important;
}

/* Debug: Make sure content sections are visible */
.content-section {
    display: none;
}

.content-section.active {
    display: block !important;
}

/* Weekly Checklist Styles */
.weekly-checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: white;
}

.checklist-title h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.checklist-title p {
    font-size: 1.1rem;
    opacity: 0.9;
    text-align: center;
}

.checklist-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.role-legend {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
}

.role-badge.tank {
    background: #3b82f6;
    color: white;
}

.role-badge.dps {
    background: #ef4444;
    color: white;
}

.role-badge.support {
    background: #10b981;
    color: white;
}

.role-badge.healer {
    background: #10b981;
    color: white;
}

.week-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.week-input {
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.attendance-table-container {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 2rem;
}

.attendance-table {
    width: 100%;
    border-collapse: collapse;
}

.attendance-table .table-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.attendance-table th {
    padding: 1.5rem 1rem;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    text-align: center;
    vertical-align: middle;
}

.week-header {
    background: var(--primary) !important;
    color: white !important;
    font-size: 0.8rem;
    padding: 0.75rem 0.5rem !important;
    border-right: 2px solid var(--secondary);
    text-align: center;
    line-height: 1.2;
}

.week-header small {
    font-size: 0.7rem;
    opacity: 0.8;
    display: block;
    margin-top: 2px;
}

.week-header:last-child {
    border-right: none;
}

.member-col {
    width: 150px;
    min-width: 150px;
    text-align: center;
    padding: 0.5rem;
}

.member-info {
    text-align: center;
    padding: 0;
    margin: 0;
}

.member-name {
    text-align: center;
    padding: 0;
    margin: 0;
}

.role-col {
    width: 100px;
    min-width: 100px;
    text-align: center;
}

.day-col {
    width: 60px;
    min-width: 60px;
    text-align: center;
    padding: 0.5rem !important;
}

.attendance-col {
    width: 100px;
    min-width: 100px;
    text-align: center;
    padding: 0.5rem !important;
}

.status-col {
    width: 100px;
    min-width: 100px;
    text-align: center;
    padding: 0.5rem !important;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.present {
    background: #10b981;
    color: white;
}

.status-badge.absent {
    background: #ef4444;
    color: white;
}

.attendance-table {
    table-layout: fixed;
    width: 100%;
}

.attendance-table th,
.attendance-table td {
    vertical-align: middle;
}

.attendance-table th.member-col {
    text-align: center;
    padding: 0.5rem;
}

.attendance-table td.member-col {
    text-align: center;
    padding: 0.5rem;
}

.attendance-table th.role-col {
    text-align: center;
}

.attendance-table th.attendance-col {
    text-align: center;
}

.attendance-table th.status-col {
    text-align: center;
}

.attendance-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.attendance-table tbody tr:hover {
    background: var(--background);
}

.attendance-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary);
}

.member-info {
    text-align: center;
}

.member-name {
    font-weight: 600;
    color: var(--text);
    text-align: center;
}

.member-role {
    font-size: 0.875rem;
    color: var(--text-muted);
}


@media (max-width: 768px) {
    .weekly-checklist-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .checklist-actions {
        justify-content: center;
    }
    
    
    .attendance-table {
        font-size: 0.875rem;
    }
    
    .attendance-table th,
    .attendance-table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

