/* ============ Akash's Daily Master Schedule — UI ============ */

:root {
    --ink: #1e293b;
    --muted: #64748b;
    --brand1: #4f46e5;
    --brand2: #7c3aed;
    --bg: #f1f5f9;
    --card: #ffffff;
    --ok: #16a34a;
}

html { font-size: 15px; }

body {
    background: linear-gradient(180deg, #eef2ff 0%, var(--bg) 260px);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* ---- top bar ---- */
.topbar {
    background: linear-gradient(90deg, var(--brand1), var(--brand2));
    box-shadow: 0 4px 18px rgba(79, 70, 229, .35);
}

.brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 700;
    font-size: 1.12rem;
    letter-spacing: .2px;
}

.brand-icon { font-size: 1.4rem; }

.navbar .nav-link { font-weight: 500; opacity: .92; }
.navbar .nav-link:hover { opacity: 1; }

/* ---- hero ---- */
.hero-card {
    border-radius: 18px;
    background: var(--card);
}

.hero-title {
    font-size: 1.55rem;
    font-weight: 800;
    background: linear-gradient(90deg, var(--brand1), var(--brand2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.progress-ring {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--brand1);
    background:
        radial-gradient(closest-side, white 78%, transparent 80% 100%),
        conic-gradient(var(--ok) var(--p, 0%), #e2e8f0 0);
    background-color: white;
    border: 1px solid #e2e8f0;
}

.day-progress { border-radius: 99px; overflow: hidden; }

/* ---- LIVE jump button (top) + scroll highlight ---- */
.live-jump-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
}

.btn-scroll-live {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    max-width: 100%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    border: 1px solid #b91c1c;
    color: #fff;
    font-weight: 700;
    padding: .55rem 1rem;
    border-radius: 99px;
    box-shadow: 0 6px 16px rgba(220, 38, 38, .32);
}

.btn-scroll-live:hover,
.btn-scroll-live:focus {
    color: #fff;
    background: linear-gradient(90deg, #dc2626, #b91c1c);
    box-shadow: 0 8px 20px rgba(220, 38, 38, .4);
    transform: translateY(-1px);
}

.btn-scroll-live:active { transform: translateY(0); }

.btn-scroll-live.is-upcoming {
    background: linear-gradient(90deg, var(--brand1), var(--brand2));
    border-color: #4338ca;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .32);
}

.btn-scroll-live.is-upcoming:hover,
.btn-scroll-live.is-upcoming:focus {
    background: linear-gradient(90deg, #4338ca, #6d28d9);
    box-shadow: 0 8px 20px rgba(79, 70, 229, .4);
}

.btn-scroll-live .js-live-btn-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-btn-dot { background: #fff; box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }

.live-btn-meta {
    background: rgba(255, 255, 255, .22);
    border: 1px solid rgba(255, 255, 255, .35);
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .72rem;
    font-weight: 700;
    padding: .18rem .55rem;
    border-radius: 99px;
    white-space: nowrap;
}

.live-jump-hint { flex: 1 1 220px; }

/* scroll-margin: sticky topbar ke neeche card/task chipka na dikhe */
.block-card { scroll-margin-top: 92px; }
.task-row { scroll-margin-top: 108px; }

/* Scroll ke baad target 2-3 sec chamakta hai, taaki aankh wahi ruk jaye */
.block-card.live-scroll-highlight {
    animation: liveTargetGlow 2.6s ease-out;
}

.task-row.live-scroll-highlight {
    animation: liveTaskGlow 2.6s ease-out;
}

@keyframes liveTargetGlow {
    0%, 55% { box-shadow: 0 0 0 3px rgba(239, 68, 68, .85), 0 10px 28px rgba(239, 68, 68, .35) !important; }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes liveTaskGlow {
    0%, 55% { background-color: #fef9c3; box-shadow: inset 0 0 0 2px rgba(239, 68, 68, .85); }
    100% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0); }
}

@media (max-width: 575.98px) {
    .live-jump-row { flex-direction: column; align-items: stretch; }
    .btn-scroll-live { justify-content: center; width: 100%; }
    .live-jump-hint { flex: none; text-align: center; }
}

/* ---- timeline + blocks ---- */
.timeline { position: relative; padding-left: 16px; }
.timeline::before {
    content: "";
    position: absolute;
    left: 3px; top: 8px; bottom: 8px;
    width: 3px;
    background: linear-gradient(180deg, var(--brand1), var(--brand2), #f59e0b, #0ea5e9);
    border-radius: 9px;
}

/* ---- Live Animated Countdown Banner inside Timeline ---- */
.timeline-countdown-card {
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
    border-left: 6px solid #ef4444 !important;
    box-shadow: 0 6px 20px rgba(79, 70, 229, .1) !important;
}

.live-pulse-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    position: relative;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .7);
    animation: livePulse 1.6s infinite;
}

@keyframes livePulse {
    0% { transform: scale(.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, .75); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { transform: scale(.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.countdown-eyebrow {
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: #ef4444;
}

.countdown-block-name {
    font-size: 1.05rem;
    color: var(--ink);
}

.countdown-timer-boxes {
    user-select: none;
}

.timer-box {
    min-width: 54px;
    padding: .35rem .5rem;
    border-radius: 12px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .18);
    border: 1px solid #334155;
}

.timer-box-sec {
    background: linear-gradient(180deg, var(--brand1) 0%, var(--brand2) 100%);
    border-color: #6366f1;
}

.timer-num {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: .5px;
    display: inline-block;
}

.timer-num.tick-pop {
    animation: tickPop .28s ease-out;
}

@keyframes tickPop {
    0% { transform: scale(1.16); }
    100% { transform: scale(1); }
}

.timer-unit {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .8px;
    opacity: .82;
    margin-top: 2px;
}

.timer-sep {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--brand1);
    animation: blinkSep 1s infinite;
}

@keyframes blinkSep {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

.countdown-progress {
    border-radius: 99px;
    overflow: hidden;
    background: #e2e8f0;
}

.countdown-progress .progress-bar {
    background: linear-gradient(90deg, var(--brand1), var(--brand2), #ef4444);
    transition: width .5s ease;
}

.now-line {
    position: absolute;
    left: -12px;
    right: 0;
    height: 0;
    border-top: 2px dashed #ef4444;
    z-index: 6;
    pointer-events: none;
    transition: top .6s cubic-bezier(.4, 0, .2, 1);
}

.now-dot {
    position: absolute;
    left: -5px;
    top: -6px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, .7);
    animation: livePulse 1.6s infinite;
}

.now-chip {
    position: absolute;
    top: -13px;
    right: 10px;
    background: linear-gradient(90deg, #ef4444, #dc2626);
    color: white;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 99px;
    box-shadow: 0 3px 10px rgba(239, 68, 68, .35);
    white-space: nowrap;
}

.now-chip-cd {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 800;
}

.block-card {
    border-radius: 16px;
    overflow: hidden;
    border-left: 6px solid var(--brand1) !important;
    transition: box-shadow .25s ease, transform .25s ease;
}

.block-card-active {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, .28), 0 8px 24px rgba(79, 70, 229, .14) !important;
}

.block-live-countdown {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .74rem;
    font-weight: 700;
    padding: .32em .65em;
    border-radius: 99px;
}

.block-live-active {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    animation: softGlow 2s infinite;
}

.block-live-upcoming {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

@keyframes softGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .25); }
    50% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
}

.block-header { background: #f8fafc; padding: .95rem 1.15rem; }
.block-title { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: 1.03rem; }
.block-emoji { font-size: 1.35rem; }
.block-desc { color: var(--muted); font-size: .86rem; margin-top: .35rem; max-width: 60ch; }

/* Block header master checkbox ("Sab") */
.block-all-form {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: 0;
}

.block-check {
    width: 22px;
    height: 22px;
    border: 2px solid var(--brand1);
    border-radius: 7px;
    cursor: pointer;
    accent-color: var(--brand1);
    margin: 0;
}

.block-check:hover { box-shadow: 0 0 0 3px rgba(79, 70, 229, .18); }
.block-check:disabled { opacity: .45; cursor: not-allowed; }

.block-all-label {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--brand1);
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 99px;
    padding: .12rem .5rem;
    user-select: none;
    cursor: pointer;
}

.badge-time {
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
    padding: .35em .65em;
}

/* block category colors */
.cat-it { border-left-color: #4f46e5 !important; }
.cat-it .badge-time { background: #e0e7ff; color: #3730a3; }
.cat-lab { border-left-color: #0d9488 !important; }
.cat-lab .badge-time { background: #ccfbf1; color: #0f766e; }
.cat-printing { border-left-color: #ea580c !important; }
.cat-printing .badge-time { background: #ffedd5; color: #c2410c; }
.cat-management { border-left-color: #7c3aed !important; }
.cat-management .badge-time { background: #ede9fe; color: #6d28d9; }
.cat-rest { border-left-color: #16a34a !important; }
.cat-rest .badge-time { background: #dcfce7; color: #15803d; }
.cat-break { border-left-color: #0284c7 !important; }
.cat-break .badge-time { background: #e0f2fe; color: #0369a1; }
.cat-routine { border-left-color: #f59e0b !important; }
.cat-routine .badge-time { background: #fef3c7; color: #b45309; }
.cat-general { border-left-color: #64748b !important; }

/* ---- tasks ---- */
.task-row { padding: .7rem 1.15rem; }
.task-row.done .task-title { text-decoration: line-through; color: #94a3b8; }
.task-title { font-weight: 600; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.task-time {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .78rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: .1rem .4rem;
    color: #475569;
}
.task-notes { color: var(--muted); font-size: .84rem; margin-top: .15rem; }
.rule-row { background: #fffbeb; }

.check-btn {
    width: 26px; height: 26px;
    border-radius: 8px;
    border: 2px solid #cbd5e1;
    background: white;
    color: white;
    font-size: .85rem;
    line-height: 1;
    flex: 0 0 auto;
    margin-top: 1px;
}
.check-btn:hover { border-color: var(--ok); }
.check-btn.checked {
    background: var(--ok);
    border-color: var(--ok);
}

.check-btn-sm {
    width: 20px; height: 20px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    background: white;
    color: white;
    font-size: .7rem;
    line-height: 1;
}
.check-btn-sm.checked { background: var(--ok); border-color: var(--ok); }

/* ---- sidebar ---- */
.sidebar-card { border-radius: 16px; }
.sidebar-header {
    background: linear-gradient(90deg, #eef2ff, #f5f3ff);
    font-size: .98rem;
    padding: .8rem 1.15rem;
}

.task-date-scope-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: .65rem .8rem;
}

.btn-xs {
    padding: .18rem .45rem;
    font-size: .74rem;
    border-radius: 7px;
}

.top3-list { list-style: none; padding-left: 0; margin-bottom: 0; }
.top3-list li {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .45rem 0;
    border-bottom: 1px dashed #e2e8f0;
    font-weight: 600;
}
.top3-list li.done > span { text-decoration: line-through; color: #94a3b8; }

.golden-rule {
    padding: .6rem .75rem;
    border-left: 4px solid var(--brand2);
    background: #faf5ff;
    border-radius: 8px;
    margin-bottom: .55rem;
    font-size: .88rem;
}

.how-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: .85rem 1rem;
    height: 100%;
}

/* ---- footer ---- */
.footer-band {
    margin-top: 2.2rem;
    background: #0f172a;
    color: #cbd5e1;
    padding: 1.05rem 0;
    font-size: .86rem;
}

/* ---- misc ---- */
.btn { border-radius: 9px; }
.card { border-radius: 14px; }
code { color: #7c3aed; }
.min-w-0 { min-width: 0; }
.page-heading { font-size: 1.45rem; font-weight: 800; }

/* ---- task row inner layout ---- */
.task-row-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .65rem;
}

.task-title-text {
    word-break: break-word;
}

.block-header-main {
    min-width: 0;
    flex: 1 1 auto;
}

/* ---- mobile bottom navigation bar ---- */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, .08);
    padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom, 0px));
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .12rem;
    text-decoration: none;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    padding: .25rem .2rem;
    border-radius: 10px;
    transition: color .15s ease, background-color .15s ease;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
    color: var(--brand1);
}

.mobile-nav-item.active {
    color: var(--brand1);
    font-weight: 700;
    background: #eef2ff;
}

.mobile-nav-icon {
    font-size: 1.15rem;
    line-height: 1.1;
}

.mobile-nav-label {
    line-height: 1.1;
}

/* ---- Block → Start/End slot picker (naya task / edit task) ---- */
.block-slot-hint {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.block-slot-chip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: .3rem .55rem;
}

.block-slot-chip strong { color: var(--brand1); }

.block-slot-chip-task {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.block-slot-chip-task .js-task-range {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.block-slot-tag {
    margin-left: auto;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--brand1);
    background: #e0e7ff;
    border: 1px solid #c7d2fe;
    border-radius: 99px;
    padding: .05rem .45rem;
    white-space: nowrap;
}

.js-block-time-picker .form-select {
    font-variant-numeric: tabular-nums;
}

.js-slot-warning {
    margin-top: .35rem;
    font-size: .78rem;
}

/* ---- tablet & mobile adjustments (< 992px) ---- */
@media (max-width: 991.98px) {
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    .footer-band {
        margin-top: 1.5rem;
        padding: .85rem 0;
        font-size: .8rem;
    }

    #quick-add-card,
    #top3-card {
        scroll-margin-top: 72px;
    }
}

/* ---- mobile table-to-card layout for Tasks page (< 768px) ---- */
@media (max-width: 767.98px) {
    /* Prevent iOS/Android auto-zoom on input focus */
    .form-control,
    .form-select {
        font-size: 16px;
    }

    .page-heading {
        font-size: 1.2rem;
    }

    .tasks-card {
        background: transparent;
        box-shadow: none !important;
    }

    .tasks-responsive-table thead {
        display: none;
    }

    .tasks-responsive-table,
    .tasks-responsive-table tbody {
        display: block;
        width: 100%;
    }

    .tasks-responsive-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: .45rem .65rem;
        background: var(--card);
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        padding: .85rem 1rem;
        margin-bottom: .75rem;
        box-shadow: 0 2px 6px rgba(15, 23, 42, .04);
    }

    .tasks-responsive-table tbody tr.table-success {
        background: #f0fdf4;
        border-color: #bbf7d0;
    }

    .tasks-responsive-table tbody td {
        border: 0;
        padding: 0;
        font-size: .85rem;
    }

    .tasks-responsive-table tbody td.td-status {
        order: 1;
    }

    .tasks-responsive-table tbody td.td-task {
        order: 2;
        flex: 1 1 calc(100% - 44px);
        font-size: .96rem;
    }

    .tasks-responsive-table tbody td:not(.td-status):not(.td-task):not(.td-actions) {
        order: 3;
        display: inline-flex;
        align-items: center;
        gap: .25rem;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        padding: .18rem .5rem;
        font-size: .78rem;
    }

    .tasks-responsive-table tbody td:not(.td-status):not(.td-task):not(.td-actions)::before {
        content: attr(data-label) ":";
        font-weight: 600;
        color: var(--muted);
    }

    .tasks-responsive-table tbody td.td-actions {
        order: 4;
        width: 100%;
        padding-top: .45rem;
        margin-top: .2rem;
        border-top: 1px dashed #e2e8f0;
        display: flex;
        justify-content: flex-end;
    }
}

/* ---- phone adjustments (< 576px) ---- */
@media (max-width: 575.98px) {
    .brand {
        font-size: .98rem;
        gap: .4rem;
    }

    .brand-icon {
        font-size: 1.2rem;
    }

    .hero-title {
        font-size: 1.18rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: .8rem;
    }

    .progress-ring {
        width: 60px;
        height: 60px;
        font-size: .88rem;
    }

    .hero-controls {
        flex-direction: column;
        align-items: stretch !important;
    }

    .date-nav-group {
        width: 100%;
    }

    .date-nav-group .btn {
        flex: 1;
        padding: .45rem .5rem;
        font-size: .88rem;
    }

    .date-picker-form {
        width: 100%;
    }

    .timeline {
        padding-left: 12px;
    }

    .timeline::before {
        left: 2px;
    }

    .now-line {
        left: -10px;
    }

    .now-dot {
        left: -4px;
    }

    .now-chip {
        right: 4px;
        font-size: .68rem;
        padding: 2px 8px;
    }

    .countdown-timer-boxes {
        width: 100%;
        justify-content: center;
    }

    .timer-box {
        flex: 1;
        max-width: 76px;
        padding: .35rem .4rem;
    }

    .timer-num {
        font-size: 1.15rem;
    }

    .block-header {
        padding: .75rem .85rem;
    }

    .block-title {
        font-size: .95rem;
        gap: .38rem;
    }

    .block-emoji {
        font-size: 1.15rem;
    }

    .block-check {
        width: 24px;
        height: 24px;
    }

    .task-row {
        padding: .75rem .85rem;
    }

    .task-row-inner {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }

    .check-btn {
        width: 28px;
        height: 28px;
    }

    .task-actions {
        padding-left: 2.25rem;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .task-actions .btn {
        padding: .28rem .6rem;
        font-size: .8rem;
    }

    .calendar-block-actions,
    .calendar-item-actions {
        width: 100%;
    }
}
