/* ======= Subject Tracking System ======= */

/* Subject Card on timer page */
.subject-card {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.subject-card:hover {
    transform: translateY(-1.04px);
    border-color: rgba(0, 230, 214, 0.3);
    box-shadow: 0 4.16px 12.48px rgba(0, 230, 214, 0.1);
}
.subject-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1.56px;
    background: linear-gradient(90deg, #00e6d6, #4ECDC4);
    opacity: 0.8;
}

/* ======= Subject Modal ======= */
.subject-modal-body {
    padding: 0.78rem 0;
}

/* Toggle Row */
.subject-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.78rem;
    background: var(--glass);
    border: 0.52px solid var(--glass-border);
    border-radius: 9.36px;
    margin-bottom: 1.04rem;
}

.subject-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 0.13rem;
}

.subject-toggle-title {
    font-size: 0.728rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.312rem;
}

.subject-toggle-desc {
    font-size: 0.52rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Toggle Switch */
.subject-toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.subject-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.subject-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.subject-toggle-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.subject-toggle-switch input:checked + .subject-toggle-slider {
    background: linear-gradient(135deg, #00e6d6, #00b4d8);
    border-color: rgba(0, 230, 214, 0.4);
    box-shadow: 0 0 12px rgba(0, 230, 214, 0.2);
}

.subject-toggle-switch input:checked + .subject-toggle-slider::before {
    transform: translateX(16px);
    background: #fff;
}

/* Disabled State Overlay */
.subject-disabled-state {
    text-align: center;
    padding: 1.56rem 0.78rem;
    color: var(--muted);
}

.subject-disabled-icon {
    font-size: 2rem;
    margin-bottom: 0.52rem;
    opacity: 0.5;
    filter: grayscale(0.5);
}

.subject-disabled-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.26rem;
}

.subject-disabled-text {
    font-size: 0.572rem;
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto;
}

/* Subject Create Section */
.subject-create-section {
    background: var(--glass);
    border: 0.52px solid var(--glass-border);
    border-radius: 9.36px;
    padding: 0.65rem 0.78rem;
    margin-bottom: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.442rem;
}

.subject-create-input {
    flex: 1;
    padding: 0.52rem 0.676rem;
    background: var(--card);
    border: 1.04px solid rgba(255, 255, 255, 0.08);
    border-radius: 7.28px;
    color: var(--text);
    font-size: 0.676rem;
    font-family: inherit;
    transition: all 0.3s ease;
    min-width: 0;
}
.subject-create-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 1.56px rgba(0, 230, 214, 0.15);
}
.subject-create-input::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.subject-add-btn {
    padding: 0.52rem 0.78rem;
    background: linear-gradient(135deg, #00e6d6, #00b4d8);
    color: #fff;
    border: none;
    border-radius: 7.28px;
    font-size: 0.598rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.26rem;
    transition: all 0.25s ease;
    box-shadow: 0 2.08px 7.28px rgba(0, 230, 214, 0.25);
    flex-shrink: 0;
}
.subject-add-btn:hover {
    transform: translateY(-0.52px);
    box-shadow: 0 3.12px 10.4px rgba(0, 230, 214, 0.35);
}
.subject-add-btn:active {
    transform: translateY(0);
}

.subject-count-badge {
    font-size: 0.494rem;
    color: var(--muted);
    text-align: right;
    margin-bottom: 0.39rem;
    font-weight: 500;
}

/* Subject List */
.subject-list {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 0.13rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.subject-list::-webkit-scrollbar {
    width: 2.6px;
}
.subject-list::-webkit-scrollbar-track {
    background: transparent;
}
.subject-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2.08px;
}

/* Subject Item */
.subject-item {
    display: flex;
    align-items: center;
    gap: 0.52rem;
    padding: 0.52rem 0.65rem;
    border-radius: 8.32px;
    background: var(--glass);
    border: 0.52px solid var(--glass-border);
    margin-bottom: 0.312rem;
    transition: all 0.25s ease;
}
.subject-item:hover {
    border-color: rgba(0, 230, 214, 0.25);
    background: rgba(255, 255, 255, 0.04);
}

.subject-item-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.subject-item-name {
    flex: 1;
    font-size: 0.728rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.subject-delete-btn {
    width: 22px;
    height: 22px;
    border-radius: 6.24px;
    border: 0.52px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.468rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.subject-delete-btn:hover {
    border-color: #ff4d6d;
    color: #ff4d6d;
    background: rgba(255, 77, 109, 0.08);
    transform: scale(1.05);
}
.subject-delete-btn:active {
    transform: scale(0.95);
}

.subject-empty-msg {
    color: var(--muted);
    text-align: center;
    padding: 1.3rem 0.52rem;
    font-size: 0.676rem;
    opacity: 0.8;
    line-height: 1.5;
}

/* ======= Subject Selector Modal (appears before timer start) ======= */
.subject-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.52rem;
    padding: 0.52rem 0;
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.subject-select-grid::-webkit-scrollbar {
    width: 2.6px;
}
.subject-select-grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2.08px;
}

.subject-select-card {
    display: flex;
    align-items: center;
    gap: 0.442rem;
    padding: 0.65rem 0.78rem;
    border-radius: 9.36px;
    background: var(--glass);
    border: 1.04px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}
.subject-select-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.subject-select-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 230, 214, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.subject-select-card:hover::before {
    opacity: 1;
}
.subject-select-card:active {
    transform: translateY(-1px) scale(0.98);
}

.subject-select-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.subject-select-name {
    font-size: 0.728rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subject-select-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 1.56rem;
    color: var(--muted);
    font-size: 0.676rem;
}

/* Inline create in selector modal */
.subject-select-create {
    display: flex;
    align-items: center;
    gap: 0.442rem;
    padding: 0.52rem 0;
    margin-top: 0.52rem;
    border-top: 0.52px solid var(--glass-border);
}

.subject-select-create-input {
    flex: 1;
    padding: 0.52rem 0.676rem;
    background: var(--card);
    border: 1.04px solid rgba(255, 255, 255, 0.08);
    border-radius: 7.28px;
    color: var(--text);
    font-size: 0.676rem;
    font-family: inherit;
    transition: all 0.3s ease;
    min-width: 0;
}
.subject-select-create-input:focus {
    outline: none;
    border-color: var(--neon-cyan);
    box-shadow: 0 0 0 1.56px rgba(0, 230, 214, 0.15);
}
.subject-select-create-input::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

/* ======= Subject Analytics Section ======= */
.subject-analytics-section {
    margin-bottom: 1.56rem;
}

.subject-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.78rem;
    margin-bottom: 0.78rem;
}

.subject-chart-card {
    background: var(--card);
    backdrop-filter: blur(10.4px);
    border: 0.52px solid rgba(255, 255, 255, 0.08);
    border-radius: 12.48px;
    padding: 1.04rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.subject-chart-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2.08px;
    background: linear-gradient(90deg, #00e6d6, #4ECDC4, #45B7D1);
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.subject-chart-card:hover::before {
    transform: scaleX(1);
}
.subject-chart-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0, 230, 214, 0.2);
}

.subject-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.78rem;
}

.subject-chart-title {
    font-size: 0.728rem;
    font-weight: 700;
    color: var(--text);
}

.subject-chart-subtitle {
    font-size: 0.494rem;
    color: var(--muted);
    margin-top: 0.13rem;
}

.subject-chart-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
}

.subject-chart-canvas-wrap {
    position: relative;
    width: 100%;
    max-height: 220px;
}

.subject-chart-canvas-wrap canvas {
    max-height: 220px;
}

/* Subject Legend Card */
.subject-legend-card {
    background: var(--card);
    backdrop-filter: blur(10.4px);
    border: 0.52px solid rgba(255, 255, 255, 0.08);
    border-radius: 12.48px;
    padding: 0.78rem 1.04rem;
    box-shadow: var(--shadow);
}

.subject-legend-title {
    font-size: 0.624rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.52rem;
    display: flex;
    align-items: center;
    gap: 0.312rem;
}

.subject-legend-title i {
    color: var(--neon-cyan);
    font-size: 0.728rem;
}

.subject-legend-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.39rem 0.78rem;
}

.subject-legend-item {
    display: flex;
    align-items: center;
    gap: 0.312rem;
    font-size: 0.572rem;
    color: var(--muted);
    font-weight: 500;
}

.subject-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.subject-legend-time {
    font-weight: 600;
    color: var(--text);
    margin-left: 0.13rem;
    font-size: 0.52rem;
}

/* No subject data state */
.subject-analytics-empty {
    text-align: center;
    padding: 1.56rem;
    color: var(--muted);
    font-size: 0.624rem;
    opacity: 0.7;
}

.subject-analytics-empty i {
    font-size: 1.56rem;
    display: block;
    margin-bottom: 0.52rem;
    opacity: 0.4;
}

/* ======= Mobile Responsive ======= */
@media (max-width: 768px) {
    .subject-analytics-grid {
        grid-template-columns: 1fr;
    }

    .subject-select-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.39rem;
    }

    .subject-select-card {
        padding: 0.52rem 0.624rem;
    }

    .subject-select-name {
        font-size: 0.676rem;
    }

    .subject-toggle-row {
        padding: 0.52rem 0.624rem;
    }

    .subject-toggle-title {
        font-size: 0.676rem;
    }

    .subject-toggle-desc {
        font-size: 0.468rem;
    }

    .subject-create-section {
        flex-wrap: wrap;
    }

    .subject-create-input {
        flex: 1 1 100%;
    }

    .subject-add-btn {
        width: 100%;
        justify-content: center;
    }

    .subject-chart-canvas-wrap {
        max-height: 180px;
    }

    .subject-chart-canvas-wrap canvas {
        max-height: 180px;
    }

    .subject-legend-grid {
        gap: 0.312rem 0.52rem;
    }

    .subject-legend-item {
        font-size: 0.52rem;
    }
}

@media (max-width: 480px) {
    .subject-select-grid {
        grid-template-columns: 1fr 1fr;
    }

    .subject-select-create {
        flex-wrap: wrap;
    }

    .subject-select-create-input {
        flex: 1 1 100%;
    }
}

/* PC specific sizing adjustments */
@media (min-width: 768px) {
    /* 25% larger text for specific section titles */
    #subjectAnalyticsSection .section-title,
    #subjectAnalyticsSection + .charts-section-title .section-title {
        font-size: 1.25em !important;
    }

    /* subject modal width 2x, height 50% larger */
    #subjectModal .modal-content {
        max-width: 650px !important;

        max-height: 66.3vh !important;
    }

    /* select subject modal width 1.7x, height 50% larger */
    #subjectSelectModal .modal-content {
        max-width: 550px !important;
        max-height: 66.3vh !important;
    }
}

/* Fix invisible icons in section titles due to gradient text transparency */
.section-title .glass-icon-box i { -webkit-text-fill-color: currentColor !important; }
