:root {
    --primary: #2563EB;
    --primary-dark: #1E40AF;
    --bg: #F5F9FF;
    /* Soft Light Blue */
    --card-bg: #FFFFFF;
    --text-main: #1E293B;
    --text-secondary: #64748B;
    --success: #22C55E;
    --danger: #EF4444;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

/* Dark Mode Variables */
body.dark-mode {
    --bg: #0F172A;
    --card-bg: #1E293B;
    --text-main: #F3F4F6;
    --text-secondary: #9CA3AF;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Unified Drawer Styles */
.profile-preview {
    text-align: center;
    padding: 1.5rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);
    cursor: pointer;
    background: var(--primary); /* Use primary as fallback to avoid white gaps */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-edit-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    height: 32px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    z-index: 2;
}

.avatar-edit-overlay svg {
    width: 16px;
    height: 16px;
    opacity: 0.9;
}

.avatar-wrapper:hover .avatar-edit-overlay {
    background: rgba(0, 0, 0, 0.8);
    height: 38px;
}

#profile-display-name {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
}

.sub-text {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    opacity: 0.8;
}

.drawer-section .section-title {
    opacity: 0.6;
    font-weight: 600;
}

/* Ensure the Done button is prominent */
.btn-primary.btn-block {
    padding: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

@media (max-width: 480px) {
    .profile-drawer {
        width: 100%;
        max-width: 100%;
    }
}

.drawer-section {
    padding: 0 0.5rem;
}

/* Header Avatar Button (Simplified) */
.header-avatar-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: var(--primary);
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.header-avatar-btn:active {
    transform: scale(0.92);
}

.header-avatar-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chip-avatar-mini {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    background: var(--primary);
}

/* Membership Card in Drawer */
.membership-section {
    margin-top: 0.5rem;
}

.membership-card {
    background: var(--bg-secondary, #f1f5f9);
    border-radius: 16px;
    padding: 1.25rem;
    margin: 0.5rem;
    border: 1px solid var(--border);
}

.plan-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--primary);
    color: white;
}

.days-remaining {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-manage-plan {
    width: 100%;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-manage-plan:hover {
    background: rgba(37, 99, 235, 0.05);
}

.btn-manage-plan svg {
    transition: transform 0.2s ease;
}

.btn-manage-plan:hover svg {
    transform: translateX(4px);
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin: 1.5rem 0 0.5rem 0.5rem;
}

.action-row {
    width: 100%;
    display: flex;
    align-items: center;
    padding: 1rem;
    background: none;
    border: none;
    border-radius: 12px;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    font-size: 1rem;
    gap: 1rem;
}

.action-row:hover {
    background: var(--bg-hover);
}

.action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--primary-color);
}

.text-danger {
    color: #ef4444;
}

.text-danger .action-icon {
    color: #ef4444;
}

.drawer-divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
}

.drawer-footer {
    margin-top: auto;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-left: auto;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Screens */
.screen {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Setup Style */
.setup-container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.setup-container h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.setup-container p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group.horizontal {
    flex-direction: row;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
}

.radio-card span {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.radio-card input:checked+span {
    border-color: var(--primary);
    background-color: #EFF6FF;
    color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
}

/* App Header & Date Picker */
.app-header {
    position: sticky;
    top: 0;
    background: var(--bg);
    /* or backdrop-filter if supported */
    z-index: 10;
    padding-bottom: 10px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 10px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
}

.date-picker-wrapper {
    overflow: hidden;
    margin: 0 -20px;
    /* Bleed to edge */
}

.date-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 20px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    /* Firefox */
}

.date-scroll::-webkit-scrollbar {
    display: none;
}

.date-card {
    flex: 0 0 auto;
    width: 60px;
    height: 80px;
    background: var(--card-bg);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    scroll-snap-align: center;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.date-card.selected {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.date-day {
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.8;
}

.date-num {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2px;
}

/* Main Content */
#main-content {
    flex: 1;
    padding-bottom: 40px;
}

.subject-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subject-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.subject-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    background: #F1F5F9;
    padding: 4px 8px;
    border-radius: 6px;
}

.subject-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 8px 0 2px;
}

.subject-full-name {
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 4px;
    font-weight: 500;
}

.subject-type {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.attendance-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn-action {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-present {
    color: var(--success);
    border-color: var(--success);
}

.btn-absent {
    color: var(--danger);
    border-color: var(--danger);
}

/* Active States */
.btn-present.active {
    background: var(--success);
    color: white;
}

.btn-absent.active {
    background: var(--danger);
    color: white;
}

/* Break Card */
.break-card {
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Stats */
.stats-overview {
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.overall-progress {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.circular-chart {
    width: 60px;
    height: 60px;
    /* Placeholder for actual chart or simple CSS border */
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--pct, 0%), var(--bg) 0);
    display: flex;
    align-items: center;
    justify-content: center;
}

.circular-chart::before {
    content: '';
    width: 48px;
    height: 48px;
    background: var(--card-bg);
    border-radius: 50%;
}

.overall-text {
    display: flex;
    flex-direction: column;
}

#overall-percentage {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.subject-stats-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg);
}

.stat-row span:last-child {
    font-weight: 600;
}

/* Logo Styles */
.logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.app-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Holiday Button & State */
.btn-holiday {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    border-radius: 12px;
    border: 2px dashed var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-holiday.add:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EFF6FF;
}

.btn-holiday.remove {
    border-color: var(--danger);
    color: var(--danger);
    background: #FEF2F2;
}

.holiday-msg {
    text-align: center;
    padding: 40px 20px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow);
}


/* Profile Styles */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* Profile Chip (top-right header — shows name + sub days) */
.profile-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 160px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.profile-chip:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(37,99,235,0.12);
}

.chip-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.chip-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: left;
    min-width: 0;
}

.chip-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.chip-sub {
    font-size: 0.65rem;
    font-weight: 500;
    color: #f59e0b;
    white-space: nowrap;
    line-height: 1.2;
}

/* Legacy .profile-trigger (fallback) */
.profile-trigger {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-avatar {
    width: 100%;
    height: 100%;
    background: #E2E8F0;
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Drawer */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: -100%;
    /* Hidden */
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--bg);
    z-index: 100;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
    transition: right 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.drawer.active {
    right: 0;
}

.drawer-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

.drawer-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.drawer-content {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

/* Profile Form */
.profile-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}



.upload-label {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.drawer-input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    margin-bottom: 20px;
    font-size: 1rem;
}

/* --- UI ENHANCEMENTS --- */

/* Progress Bar in Card */
.subject-progress-bar {
    height: 6px;
    background: #F1F5F9;
    border-radius: 3px;
    margin: 8px 0;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Colors for progress */
.progress-green {
    background-color: var(--success);
}

.progress-yellow {
    background-color: #F59E0B;
}

.progress-red {
    background-color: var(--danger);
}

.progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: -8px;
    margin-bottom: 8px;
}

/* Horizontal Overall Bar */
.overall-bar-container {
    margin-top: 10px;
    width: 100%;
    height: 8px;
    background: #F1F5F9;
    border-radius: 4px;
    overflow: hidden;
}

.overall-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.5s ease;
}

/* Clickable Stats Circle */
.circular-chart {
    cursor: pointer;
    transition: transform 0.2s;
}

.circular-chart:active {
    transform: scale(0.95);
}

/* History Page */
.filter-bar {
    display: flex;
    gap: 10px;
    padding: 0 20px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.history-list {
    padding: 20px;
}

.history-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item.present {
    background-color: #ECFDF5;
    border-color: #A7F3D0;
}

.history-item.absent {
    background-color: #FEF2F2;
    border-color: #FECACA;
}

.history-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Saturday Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.day-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.day-btn {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    font-weight: 500;
}

.day-btn:hover {
    background: #f8fafc;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
}

/* Saturday Control */
.saturday-control {
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.saturday-control h4 {
    margin: 0 0 4px;
    color: #0369A1;
}

.saturday-control p {
    margin: 0 0 12px;
    color: #0C4A6E;
    font-size: 0.85rem;
}

.saturday-add-btn {
    background: #0EA5E9;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
}

.saturday-active-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.saturday-active-text {
    color: #15803D;
    font-weight: 500;
    font-size: 0.9rem;
}

.btn-remove-saturday {
    color: #DC2626;
    background: transparent;
    border: 1px solid #DC2626;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* Notes Page */
.notes-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 70px);
}

.notes-area {
    flex: 1;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    margin-bottom: 10px;
}

.notes-status {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    height: 20px;
}

/* Bulk Action Bar */
.bulk-actions-bar {
    display: flex;
    gap: 15px;
    padding: 5px 5px 20px 5px;
    justify-content: center;
    width: 100%;
}

.btn-bulk-action {
    flex: 1;
    max-width: 180px;
    padding: 12px 0;
    border: none;
    border-radius: 50px;
    /* Pill shape */
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s, box-shadow 0.1s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-bulk-action:active {
    transform: scale(0.97);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-present-all {
    background: linear-gradient(135deg, #22C55E 0%, #4ADE80 100%);
}

.btn-absent-all {
    background: linear-gradient(135deg, #EF4444 0%, #F87171 100%);
}

/* Dark mode contrast */
body.dark-mode .btn-present-all {
    box-shadow: 0 4px 6px rgba(34, 197, 94, 0.1);
}

body.dark-mode .btn-absent-all {
    box-shadow: 0 4px 6px rgba(239, 68, 68, 0.1);
}

/* ── Logout Button ─────────────────────────────────────────────────────────── */
.logout-btn {
    color: var(--text-secondary);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    color: var(--danger);
}

.logout-btn:active {
    transform: scale(0.92);
}

/* ── Plan Badge ──────────────────────────────────────────────────────────── */
.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.plan-badge.badge-trial {
    background: #FFF7ED;
    color: #C2410C;
    border: 1px solid #FDBA74;
}

.plan-badge.badge-active {
    background: #F0FDF4;
    color: #15803D;
    border: 1px solid #86EFAC;
}

.plan-badge.badge-expired {
    background: #FEF2F2;
    color: #B91C1C;
    border: 1px solid #FCA5A5;
}

body.dark-mode .plan-badge.badge-trial {
    background: #431407;
    color: #FB923C;
    border-color: #9A3412;
}

body.dark-mode .plan-badge.badge-active {
    background: #052E16;
    color: #4ADE80;
    border-color: #166534;
}

body.dark-mode .plan-badge.badge-expired {
    background: #450A0A;
    color: #F87171;
    border-color: #991B1B;
}

/* ── Subscription Lock Overlay ───────────────────────────────────────────── */
.subscription-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeInOverlay 0.35s ease;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subscription-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 32px 24px;
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.lock-icon {
    font-size: 48px;
    margin-bottom: 12px;
    filter: grayscale(0.2);
}

.lock-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.lock-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.lock-plan-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 10px 16px;
    background: var(--bg);
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.lock-plan-info span:first-child {
    font-weight: 600;
    color: var(--text-main);
    text-transform: capitalize;
}

.upgrade-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.upgrade-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 18px;
    border-radius: 14px;
    border: 2px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    gap: 2px;
}

.upgrade-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.15);
}

.upgrade-btn:active {
    transform: translateY(0);
}

.upgrade-plan-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.upgrade-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.upgrade-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.upgrade-semester {
    border-color: var(--primary);
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
}

body.dark-mode .upgrade-semester {
    background: linear-gradient(135deg, #1E3A5F 0%, #1E40AF22 100%);
}

.upgrade-semester .upgrade-plan-name {
    color: var(--primary-dark);
}

.lock-logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: color 0.2s;
}

.lock-logout-btn:hover {
    color: var(--danger);
}

/* ── Plan badge ─────────────────────────────────────────────────────────── */
.plan-badge {
    cursor: pointer !important;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 99px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    white-space: nowrap;
}

.plan-badge:hover {
    transform: scale(1.04);
    opacity: 0.8;
}

.badge-trial {
    background: #fff8e1;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.badge-active {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

/* ═══════════════════════════════════════════════════════════════
   MANUAL TIMETABLE MODE
═══════════════════════════════════════════════════════════════ */

/* Field-level validation error */
.field-error {
    display: block;
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 6px;
    font-weight: 500;
}

/* Manual Timetable Builder wrapper */
.manual-tt-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}

.manual-tt-header {
    margin-bottom: 28px;
}

.manual-tt-header h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 6px;
}

.manual-tt-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Each Day Card */
.manual-day-section {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s;
}

.manual-day-section.has-subjects {
    border-color: #86EFAC;
}

.manual-day-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.manual-day-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.manual-day-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Subject item in builder */
.manual-subject-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.manual-subject-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    gap: 10px;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.manual-subject-info {
    flex: 1;
    min-width: 0;
}

.manual-subject-code {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manual-subject-name {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manual-subject-remove {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    flex-shrink: 0;
    transition: all 0.15s;
    line-height: 1;
}

.manual-subject-remove:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #FEF2F2;
}

/* "+" Add Subject button */
.manual-add-subject-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    width: 100%;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s;
}

.manual-add-subject-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EFF6FF;
}

.manual-add-subject-btn .plus-icon {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

/* Error banner at bottom of builder */
.manual-tt-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: var(--danger);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 16px;
}

/* Add Subject Modal overrides */
.add-subject-modal-content {
    text-align: left;
    max-width: 360px;
    width: 92%;
}

.add-subject-modal-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-main);
}

/* dark mode tweaks for manual builder */
body.dark-mode .manual-day-section {
    box-shadow: none;
}

body.dark-mode .manual-subject-item {
    background: #0F172A;
}

body.dark-mode .manual-day-section.has-subjects {
    border-color: #166534;
}

body.dark-mode .modal-content {
    background: var(--card-bg);
    color: var(--text-main);
}

/* ═══════════════════════════════════════════════════════════════
   RESET TIMETABLE MODAL + DANGER BUTTON
═══════════════════════════════════════════════════════════════ */

/* Danger (destructive) button */
.btn-danger {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    border: none;
    background: var(--danger);
    color: #fff;
    transition: opacity 0.2s, transform 0.1s;
    margin-top: 0;
}

.btn-danger:hover  { opacity: 0.88; }
.btn-danger:active { transform: scale(0.98); }
.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Reset Timetable modal specifics */
.reset-tt-modal-content {
    text-align: left;
    max-width: 360px;
    width: 92%;
}

.reset-tt-modal-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.reset-tt-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.reset-tt-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* "Change Timetable" row in Profile Drawer — danger-tinted */
.profile-action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    cursor: pointer;
    background: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 12px;
    text-align: left;
}

.profile-action-row.danger {
    color: var(--danger);
    border-color: #FECACA;
}

.profile-action-row.danger:hover {
    background: #FEF2F2;
    border-color: var(--danger);
}

body.dark-mode .profile-action-row.danger:hover {
    background: #2D1515;
}

body.dark-mode .reset-tt-modal-content h3 {
    color: var(--text-main);
}
