/* --- New Excel-like Table View Styles --- */

/* App Navigation */
.app-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 2rem;
    border: 1px solid var(--glass-border);
}

.nav-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Backup Controls */
.backup-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.btn-utility {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-utility:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* View Sections */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease-out forwards;
    touch-action: pan-y; /* Prevents whole-app horizontal rubber banding during JS swipe */
    width: 100%; /* Ensures width calculation is exact */
}

.view-section.active {
    display: grid;
    gap: var(--card-gap, 1.25rem);
    align-content: start; /* Prevents grid from stretching items if height is large */
}

main#tableView.active {
    display: block;
    /* Table view is full width */
}

main#hourLogView.active {
    display: grid;
    /* Uses main-content layout */
}

/* Time Tracker Specifics & Frictionless Data Entry */
.quick-activity-chips, .quick-duration-container {
    max-width: 100%;
    /* Ensure scrolling momentum on iOS */
    -webkit-overflow-scrolling: touch;
}

.quick-activity-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.chip:hover, .chip:active {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
    transform: scale(0.98);
}

.chip-selected {
    background: rgba(248, 113, 113, 0.15) !important;
    border-color: rgba(248, 113, 113, 0.4) !important;
    color: #fca5a5 !important;
}

.quick-duration-container::-webkit-scrollbar {
    display: none;
}

.btn-duration {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-duration:hover, .btn-duration:active {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.time-tracker-analytics {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 1.5rem;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.05);
}

.analytics-value {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #34d399, #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.analytics-label {
    color: var(--text-secondary);
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.time-log-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.time-log-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--color-computer);
    border-radius: 1rem;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.time-log-card:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: translateX(5px);
}

.tl-task {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.tl-time-window {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tl-duration {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-computer);
    text-align: right;
}

.tl-duration span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tl-notes {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-style: italic;
    grid-column: 1 / -1;
}

/* Textarea for Short Notes */
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 60px;
    line-height: 1.5;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Edit Button */
.btn-edit {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-edit:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #e0e7ff;
}

/* Double input row layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Table Area */
.table-panel {
    padding: 0;
    overflow: hidden;
}

.table-header-section {
    padding: 2rem 2rem 1rem 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.table-header-section h2 {
    margin-bottom: 0;
}

/* Subject Tabs */
.subject-tabs {
    display: flex;
    overflow-x: auto;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    /* Hide scrollbar for tabs */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.subject-tabs::-webkit-scrollbar {
    display: none;
}

.sub-tab {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 1rem 1.5rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.sub-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.sub-tab.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Tab Active Colors */
.sub-tab[data-subject="Physics"].active {
    border-color: var(--color-physics);
    color: var(--color-physics);
}

.sub-tab[data-subject="Chemistry"].active {
    border-color: var(--color-chemistry);
    color: var(--color-chemistry);
}

.sub-tab[data-subject="Maths"].active {
    border-color: var(--color-maths);
    color: var(--color-maths);
}

.sub-tab[data-subject="Computer"].active {
    border-color: var(--color-computer);
    color: var(--color-computer);
}

.sub-tab[data-subject="English"].active {
    border-color: var(--color-english);
    color: var(--color-english);
}

.sub-tab[data-subject="Nepali"].active {
    border-color: var(--color-nepali);
    color: var(--color-nepali);
}

/* Table Container */
.table-container {
    overflow-x: auto;
    padding: 0;
}

.revision-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.revision-table th,
.revision-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.revision-table th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.revision-table tbody tr {
    transition: background 0.2s;
}

.revision-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.revision-table tbody tr:last-child td {
    border-bottom: none;
}

.center-col {
    text-align: center !important;
}

/* Status Cells */
.status-cell {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.status-cell.done {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.status-cell.pending {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px dashed var(--glass-border);
}

.status-date {
    font-size: 0.65rem;
    font-weight: 500;
    margin-top: 0.2rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.status-cell-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
}

