:root {
    --bg-dark: #070b14;
    --card-bg: rgba(255, 255, 255, 0.05);
    --accent: #7BCAD7;
    --danger: #E03D4D;
    --text-dim: #94a3b8;
    --header-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* CUSTOM SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
    background: rgba(123, 202, 215, 0.3);
    /* CPA Teal */
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

body {
    background: var(--bg-dark);
    color: white;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    background: rgba(14, 44, 133, 0.7);
    /* CPA Navy with transparency */
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(123, 202, 215, 0.2);
    /* CPA Teal border */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #7BCAD7, #44B2E4);
    /* CPA Teal to Sky Blue */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    flex-shrink: 0;
}

.header-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.breadcrumb {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.header-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 10px;
    white-space: nowrap;
}

.actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

main {
    margin-top: var(--header-height);
    height: calc(100vh - var(--header-height));
    position: relative;
    overflow: hidden;
    /* Prevent body scroll */
}

.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(50px);
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 40px;
}

.view.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

/* THE WHEEL */
.wheel-wrapper {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#main-wheel {
    width: 90vh;
    height: 90vh;
    max-width: 95%;
}

.wheel-group {
    transition: all 0.3s;
    cursor: pointer;
    transform-origin: 300px 300px;
}

.wheel-group:hover {
    filter: brightness(1.2);
    transform: scale(1.02);
}

.wheel-slice {
    stroke: rgba(255, 255, 255, 0.1);
}

.wheel-label {
    fill: white;
    font-weight: 900;
    font-size: clamp(10px, 1.5vw, 14px);
    /* Responsive font size */
    pointer-events: none;
    text-transform: uppercase;
}

/* DRILL DOWN LIST */
.content-container {
    max-width: 900px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#view-roster .content-container {
    max-width: 1400px;
}

.view-header {
    margin-bottom: 30px;
}

.view-header.sticky {
    background: var(--bg-dark);
    padding: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-link {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    margin-bottom: 10px;
    font-weight: 700;
}

.drill-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-bottom: 40px;
}

.descriptor-row {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: all 0.2s;
    user-select: none;
}

.descriptor-row.queued-pos {
    border-color: var(--accent);
    background: rgba(123, 202, 215, 0.1);
}

.descriptor-row.queued-neg {
    border-color: var(--danger);
    background: rgba(224, 61, 77, 0.1);
}

.mode-btn.active-pos {
    background: var(--accent);
    color: var(--bg-dark);
}

.mode-btn.active-neg {
    background: var(--danger);
    color: white;
}

.descriptor-text {
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.4;
}

.mode-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.mode-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mode-btn.pos {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.mode-btn.neg {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.mode-btn:active {
    transform: scale(0.9);
}

/* STUDENT GRID */
.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 20px;
    overflow-y: auto;
    padding: 10px;
    /* Space for the scale(1.05) effect */
    padding-bottom: 60px;
}

.student-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 100px;
    padding: 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.student-card.selected {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--accent);
    transform: scale(1.05);
}

.student-card .inspect-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.student-card:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.student-card.just-scored-pos {
    background: rgba(16, 185, 129, 0.3) !important;
    border-color: var(--accent);
}

.student-card.just-scored-neg {
    background: rgba(244, 63, 94, 0.3) !important;
    border-color: var(--danger);
}

.assignment-info {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
    flex: 1;
}

.mode-badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.mode-badge.pos {
    background: var(--accent);
    color: var(--bg-dark);
}

.mode-badge.neg {
    background: var(--danger);
    color: white;
}

.done-btn {
    background: var(--accent);
    color: var(--bg-dark);
    font-weight: 900;
    border: none;
    padding: 12px 30px;
    border-radius: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.done-btn:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
}

/* ANALYTICS ROSTER */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
    overflow-y: auto;
    padding: 10px;
    padding-bottom: 80px;
    width: 100%;
}

.analytics-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 25px 35px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-height: 120px;
}

.analytics-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    transform: translateY(-3px);
}

.card-main-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.student-name {
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: -0.01em;
}

.last-activity {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 600;
    margin-top: 5px;
}

.card-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.mini-dashboard {
    display: flex;
    gap: 10px;
}

.comp-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    position: relative;
}

.dot-count {
    font-size: 10px;
    font-weight: 900;
    color: white;
}


/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px;
    border-radius: 24px;
    width: 600px;
    max-width: 90%;
}

textarea {
    width: 100%;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 15px;
    border-radius: 12px;
    margin: 20px 0;
    font-family: inherit;
}

.primary-btn {
    width: 100%;
    padding: 15px;
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    border-radius: 12px;
    font-weight: 900;
    cursor: pointer;
}

/* Detail Table/List inside Modal */
.detail-item {
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    border-left: 4px solid var(--accent);
    text-align: left;
}

.detail-list {
    margin-top: 20px;
    max-height: 40vh;
    overflow-y: auto;
}

.secondary-btn {
    width: 100%;
    padding: 15px;
    background: transparent;
    color: white;
    border: none;
    margin-top: 10px;
    cursor: pointer;
}

.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--accent);
    color: var(--bg-dark);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 900;
    z-index: 3000;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.4);
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* QUEUE BAR */
.queue-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(150%);
    background: #0e2c85;
    border: 1px solid rgba(123, 202, 215, 0.3);
    padding: 10px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 30px;
    z-index: 1500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.queue-bar.active {
    transform: translateX(-50%) translateY(0);
}

.queue-info {
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
}

#queue-count {
    background: var(--accent);
    color: var(--bg-dark);
    padding: 2px 10px;
    border-radius: 20px;
    margin-right: 5px;
}

.queue-btn {
    background: var(--accent);
    color: var(--bg-dark);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 900;
    cursor: pointer;
    font-size: 0.8rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.queue-btn:active {
    transform: scale(0.95);
}

/* RESPONSIVENESS */
@media (max-width: 768px) {
    header {
        padding: 0 20px;
        gap: 10px;
    }

    .breadcrumb {
        display: none;
    }

    .actions .header-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        margin-left: 5px;
    }

    .view {
        padding: 20px;
    }

    #main-wheel {
        width: 85vw;
        height: 85vw;
    }

    .view-header.sticky {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .done-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 0.9rem;
        gap: 8px;
    }

    .header-logo {
        height: 32px;
    }

    .student-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

}