:root {
    --bg-color: #f5f3f7;
    --card-bg: #ffffff;
    --text-primary: #2d2d3a;
    --text-secondary: #6b7280;
    --accent-primary: #5b4d8a;
    --accent-secondary: #9d8db1;
    --border-color: rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.05);
    --warning: #cc8e35;
    --success: #2d8a6a;
    --header-gradient: linear-gradient(135deg, #5b4d8a 0%, #7c6eaa 100%);
}

/* Loader Animation */
.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

.loader::after {
    content: '';
    box-sizing: border-box;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-bottom-color: var(--accent-primary);
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(rgba(91, 77, 138, 0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

header {
    margin-bottom: 3rem;
    text-align: center;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Tab Navigation */
.tab-nav {
    display: inline-flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 16px;
    margin-top: 1.5rem;
    border: 1px solid var(--glass-border);
}

.tab-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.tab-content.active {
    display: block;
}

/* Main Grid (Tab 1) */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    align-items: start;
}

.content-stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
}

.search-box input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    color: var(--text-primary);
    width: 300px;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.1);
}

.progress-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    width: 200px;
}

#progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 0.5s ease;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

/* Glassmorphism Card Base */
.glass-pane {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
}

/* Table Design */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(91, 77, 138, 0.03);
}

.category-header {
    background: rgba(91, 77, 138, 0.05);
    cursor: pointer;
    transition: background 0.2s ease;
    border-left: 4px solid var(--accent-primary);
}

.category-header:hover {
    background: rgba(91, 77, 138, 0.1);
}

.category-header td {
    padding: 1rem;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    border-bottom: 1px solid var(--border-color);
}

.avatar-mini {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    justify-content: flex-end;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    width: 90%;
    max-width: 500px;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    overflow-y: auto;
    position: fixed;
    right: 0;
    top: 0;
    margin: 0;
    animation: slideInRight 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-chorist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.modal-chorist-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.modal-chorist-item:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.modal-chorist-item.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}

.slots-flex-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assignee-slot {
    width: 100%;
    min-height: 50px;
    padding: 0 1rem;
    border-radius: 12px;
    background: #fbfaff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.assignee-slot.active {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Dropdown Selection Styles */
.selection-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    margin-top: 8px;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.dropdown-search {
    padding: 1rem;
    background: #fcfbff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dropdown-search input {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.dropdown-search input:focus {
    border-color: var(--accent-primary);
}

.dropdown-list {
    max-height: 250px;
    overflow-y: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-item.selected {
    background: rgba(166, 75, 255, 0.15);
}

.dropdown-item.disabled {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}

.assignee-slot:hover {
    background: rgba(255, 255, 255, 0.1);
}

.assignee-slot.filled {
    border-style: solid;
    background: rgba(166, 75, 255, 0.1);
    border-color: rgba(166, 75, 255, 0.3);
}

.assignee-slot .slot-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.assignee-slot .slot-placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-style: italic;
    font-size: 0.9rem;
}

.modal-chorist-item.assigned {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

/* Chorist List View (Tab 2) */
.chorist-list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chorist-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--glass-border);
}

.chorist-list-item:hover {
    transform: translateX(10px);
    background: rgba(255, 255, 255, 1);
    border-color: var(--accent-primary);
    box-shadow: 0 10px 30px rgba(91, 77, 138, 0.1);
}

.chorist-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    min-width: 300px;
}

.chorist-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.chorist-name-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chorist-name-row h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.task-count-badge {
    background: rgba(91, 77, 138, 0.1);
    color: var(--accent-primary);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.chorist-progress-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 250px;
}

.progress-bar-mini {
    flex: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
    transition: width 0.6s ease;
}

.progress-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 40px;
}

.chorist-tasks-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 2;
    justify-content: flex-end;
}

.task-tag {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.task-tag.done {
    background: rgba(45, 138, 106, 0.1);
    color: var(--success);
    border-color: rgba(45, 138, 106, 0.2);
}

.task-tag.in-progress {
    background: rgba(91, 77, 138, 0.1);
    color: var(--accent-primary);
    border-color: rgba(91, 77, 138, 0.2);
}

.no-tasks-text {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Sidebar Styles */
.chorist-list {
    list-style: none;
}

.chorist-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 12px;
    cursor: grab;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
}

.chorist-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.drop-zone {
    border: 2px dashed transparent;
    border-radius: 8px;
    padding: 4px;
    transition: all 0.2s ease;
    min-width: 150px;
}

.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.1);
}

/* Buttons */
.btn-secondary {
    margin-top: 1rem;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

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

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

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: -1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}