﻿/* wwwroot/css/floating-tools.css */
/* ─── Floating Button ─── */
.floating-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 20px;
    background: #0d6efd;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s, background 0.2s;
}

    .floating-btn:hover {
        transform: scale(1.08);
        background: #0b5ed7;
    }

    .floating-btn .badge {
        position: absolute;
        top: -6px;
        right: -6px;
        background: #dc3545;
        color: white;
        border-radius: 50%;
        font-size: 11px;
        padding: 2px 6px;
        min-width: 20px;
        text-align: center;
    }

/* ─── Drop‑up Panel ─── */
.floating-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 340px;
    max-height: 520px;
    background: var(--bs-body-bg, #ffffff);
    border: 1px solid var(--bs-border-color, #ccc);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: system-ui, sans-serif;
    transition: background 0.2s, border-color 0.2s;
}

    .floating-panel .panel-header {
        background: var(--bs-tertiary-bg, #f8f9fa);
        padding: 8px 12px;
        border-bottom: 1px solid var(--bs-border-color, #ddd);
        flex-shrink: 0;
        transition: background 0.2s;
    }

    .floating-panel .panel-tabs {
        border-bottom: none;
        margin-bottom: -1px;
    }

        .floating-panel .panel-tabs .nav-item {
            margin-bottom: 0;
        }

        .floating-panel .panel-tabs .nav-link {
            padding: 6px 12px;
            font-size: 0.9rem;
            border: none;
            color: var(--bs-secondary-color, #495057);
            background: transparent;
            border-radius: 0;
            transition: color 0.2s, border-color 0.2s;
        }

            .floating-panel .panel-tabs .nav-link:hover {
                color: var(--bs-primary, #0d6efd);
            }

            .floating-panel .panel-tabs .nav-link.active {
                background: transparent;
                color: var(--bs-primary, #0d6efd);
                border-bottom: 2px solid var(--bs-primary, #0d6efd);
            }

    .floating-panel .panel-body {
        flex: 1;
        padding: 12px;
        overflow-y: auto;
        background: var(--bs-body-bg, #ffffff);
        transition: background 0.2s;
    }

        .floating-panel .panel-body .tab-pane {
            height: 100%;
        }

        .floating-panel .panel-body iframe.calc-iframe {
            width: 100%;
            height: 380px;
            border: none;
            border-radius: 6px;
        }

/* ─── Timer Container ─── */
#timer-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--bs-body-color, #212529);
}

.timer-display {
    font-size: 2.6rem;
    font-weight: bold;
    text-align: center;
    font-family: monospace;
    color: var(--bs-body-color, #212529);
}

#timer-mode-label {
    color: var(--bs-body-color, #212529);
    font-weight: 600;
}

.timer-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
}

    .timer-controls .btn {
        transition: background 0.2s, color 0.2s;
    }

.timer-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    font-size: 0.8rem;
}

    .timer-settings label {
        display: flex;
        align-items: center;
        gap: 4px;
        color: var(--bs-body-color, #212529);
    }

    .timer-settings input[type="number"] {
        width: 50px;
        background: var(--bs-body-bg, #ffffff);
        color: var(--bs-body-color, #212529);
        border: 1px solid var(--bs-border-color, #ced4da);
        border-radius: 4px;
        padding: 2px 4px;
        transition: background 0.2s, color 0.2s, border-color 0.2s;
    }

        .timer-settings input[type="number"]:focus {
            border-color: var(--bs-primary, #0d6efd);
            outline: none;
        }

.timer-history {
    max-height: 100px;
    overflow-y: auto;
    border-top: 1px solid var(--bs-border-color, #eee);
    padding-top: 6px;
    margin-top: 6px;
}

    .timer-history small {
        color: var(--bs-secondary-color, #6c757d);
    }

    .timer-history ul {
        padding-left: 0;
        margin-bottom: 0;
    }

    .timer-history li {
        padding: 2px 0;
        border-bottom: 1px solid var(--bs-border-color, #f5f5f5);
        display: flex;
        justify-content: space-between;
        color: var(--bs-body-color, #212529);
    }

    .timer-history .text-muted {
        color: var(--bs-secondary-color, #6c757d);
    }

/* ─── Session Progress ─── */
#session-progress {
    text-align: center;
    font-size: 0.85rem;
    color: var(--bs-secondary-color, #6c757d);
    padding: 4px 0;
}

    #session-progress strong {
        color: var(--bs-body-color, #212529);
    }

/* ─── Milestone Popup ─── */
.milestone-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.milestone-popup-content {
    background: var(--bs-body-bg, #ffffff);
    color: var(--bs-body-color, #212529);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 16px;
    padding: 30px 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.milestone-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .milestone-popup-header .btn-close {
        font-size: 1.2rem;
        filter: var(--bs-btn-close-filter, none);
    }

.milestone-message {
    font-size: 1.4rem;
    margin: 20px 0;
    color: var(--bs-body-color, #212529);
}

.milestone-popup .btn-close {
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--bs-body-color, #212529);
    cursor: pointer;
    padding: 4px 8px;
}

    .milestone-popup .btn-close:hover {
        color: var(--bs-danger, #dc3545);
    }

/* ─── Dark mode overrides (via data-bs-theme) ─── */
[data-bs-theme="dark"] .floating-panel {
    background: var(--bs-body-bg, #212529);
    border-color: var(--bs-border-color, #444);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

    [data-bs-theme="dark"] .floating-panel .panel-header {
        background: var(--bs-tertiary-bg, #2a2a2a);
        border-color: var(--bs-border-color, #444);
    }

    [data-bs-theme="dark"] .floating-panel .panel-tabs .nav-link {
        color: var(--bs-secondary-color, #a0a0a0);
    }

        [data-bs-theme="dark"] .floating-panel .panel-tabs .nav-link.active {
            color: var(--bs-primary, #6ea8fe);
            border-color: var(--bs-primary, #6ea8fe);
        }

    [data-bs-theme="dark"] .floating-panel .panel-body {
        background: var(--bs-body-bg, #212529);
    }

[data-bs-theme="dark"] .timer-settings input[type="number"] {
    background: var(--bs-body-bg, #2a2a2a);
    color: var(--bs-body-color, #e0e0e0);
    border-color: var(--bs-border-color, #444);
}

[data-bs-theme="dark"] .timer-history li {
    border-color: var(--bs-border-color, #333);
}

[data-bs-theme="dark"] .milestone-popup-content {
    background: var(--bs-body-bg, #2a2a2a);
    color: var(--bs-body-color, #e0e0e0);
    border-color: var(--bs-border-color, #444);
}

[data-bs-theme="dark"] .milestone-message {
    color: var(--bs-body-color, #e0e0e0);
}

[data-bs-theme="dark"] .milestone-popup .btn-close {
    color: var(--bs-body-color, #e0e0e0);
}

    [data-bs-theme="dark"] .milestone-popup .btn-close:hover {
        color: var(--bs-danger, #f87171);
    }

[data-bs-theme="dark"] #session-progress {
    color: var(--bs-secondary-color, #a0a0a0);
}

    [data-bs-theme="dark"] #session-progress strong {
        color: var(--bs-body-color, #e0e0e0);
    }

/* ─── Scrollbar styling ─── */
.floating-panel .panel-body::-webkit-scrollbar {
    width: 4px;
}

.floating-panel .panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.floating-panel .panel-body::-webkit-scrollbar-thumb {
    background: var(--bs-secondary-color, #aaa);
    border-radius: 4px;
}

    .floating-panel .panel-body::-webkit-scrollbar-thumb:hover {
        background: var(--bs-secondary-color, #888);
    }

/* ─── Responsive ─── */
@media (max-width: 480px) {
    .floating-panel {
        width: 290px;
        right: 10px;
        bottom: 70px;
        max-height: 460px;
    }

        .floating-panel .panel-body iframe.calc-iframe {
            height: 300px;
        }

    .timer-display {
        font-size: 2.2rem;
    }

    .milestone-popup-content {
        padding: 20px 24px;
    }

    .milestone-message {
        font-size: 1.1rem;
    }
}

/* ─── Popup Timer Display ─── */
.popup-timer-display {
    font-size: 3rem;
    font-weight: bold;
    font-family: monospace;
    color: var(--bs-body-color, #212529);
    margin: 10px 0 4px 0;
}

.popup-mode-label {
    font-size: 1rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 10px;
}

/* ─── Popup Session Summary ─── */
.popup-session-summary {
    font-size: 0.9rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-top: 4px;
}

/* ─── Manual Popup Button ─── */
#show-popup-btn {
    font-size: 0.75rem;
    padding: 2px 8px;
}

    #show-popup-btn:hover {
        background: var(--bs-secondary-bg, #e9ecef);
    }

/* ─── Dark mode close button fix ─── */
[data-bs-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ─── Popup action buttons ─── */
.milestone-popup-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

#popup-show-settings {
    font-size: 0.85rem;
}

#popup-start-btn {
    font-size: 1.1rem;
    padding: 8px 30px;
    border-radius: 30px;
}

/* ─── Timer running indicator ─── */
.floating-btn.running {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

.floating-btn .running-dot {
    position: absolute;
    top: -4px;
    left: -4px;      /* was: right: -4px - the count badge owns the top-right corner */
    right: auto;
    width: 14px;
    height: 14px;
    background: #28a745;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 6px rgba(40, 167, 69, 0.6);
    display: none;
}

    .floating-btn .running-dot.active {
        display: block;
    }

/* ─── Popup sound toggle ─── */
.popup-sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--bs-body-color, #212529);
}

    .popup-sound-toggle input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
        accent-color: var(--bs-primary, #0d6efd);
    }

    .popup-sound-toggle label {
        cursor: pointer;
        user-select: none;
    }


/* ═══════════════════════════════════════════════════════════
   Floating panel – three tabs fit tighter
   ═══════════════════════════════════════════════════════════ */

.floating-panel .panel-tabs .nav-link {
    padding: 6px 9px;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ═══════════════════════════════════════════════════════════
   Todos tab content
   ═══════════════════════════════════════════════════════════ */

#todos-content.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.floating-todos-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    min-height: 260px;
}

.floating-todos-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 120px;
    max-height: 340px;
    padding: 2px;
}

.floating-todos-section-title {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--bs-secondary-color, #6c757d);
    padding: 6px 4px 2px;
    margin-top: 2px;
}

    .floating-todos-section-title.is-overdue {
        color: var(--tm-danger, #dc2626);
    }

.floating-todo-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
    border: 1px solid transparent;
}

    .floating-todo-row:hover {
        background: var(--bs-secondary-bg, #f1f5f9);
    }

    .floating-todo-row.is-overdue {
        border-color: rgba(220, 38, 38, 0.18);
        background: rgba(220, 38, 38, 0.05);
    }

        .floating-todo-row.is-overdue:hover {
            background: rgba(220, 38, 38, 0.08);
        }

.floating-todo-checkbox {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--tm-primary, #0d9488);
}

.floating-todo-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.floating-todo-title {
    font-size: 0.82rem;
    color: var(--bs-body-color, #212529);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.floating-todo-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--bs-secondary-color, #6c757d);
}

.floating-todo-project {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.floating-todo-project-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--tm-primary, #0d9488);
    flex-shrink: 0;
}

.floating-todos-add {
    display: flex;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--bs-border-color, #ddd);
    flex-shrink: 0;
}

    .floating-todos-add input {
        flex: 1;
        min-width: 0;
        font-size: 0.82rem;
    }

    .floating-todos-add .btn {
        flex-shrink: 0;
        min-width: 34px;
        font-weight: 700;
        font-size: 0.9rem;
        line-height: 1;
    }

.floating-todos-open {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: var(--tm-primary, #0d9488);
    text-decoration: none;
    padding: 6px 0 2px;
    border-top: 1px solid var(--bs-border-color, #ddd);
    flex-shrink: 0;
}

    .floating-todos-open:hover {
        text-decoration: underline;
    }

/* ═══════════════════════════════════════════════════════════
   Todos tab — count badge
   ═══════════════════════════════════════════════════════════ */

.todos-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    margin-left: 4px;
    background: var(--tm-danger, #dc2626);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 999px;
}

/* ═══════════════════════════════════════════════════════════
   Today's Agenda popup
   ═══════════════════════════════════════════════════════════ */

#todoAgendaModal .modal-header {
    border-bottom: 1px solid var(--bs-border-color, #ddd);
}

#todoAgendaModal .modal-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

    #todoAgendaModal .modal-title .tm-emoji {
        width: 1.4em;
        height: 1.4em;
        vertical-align: -0.3em;
    }

.tm-agenda-date {
    font-size: 0.85rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.tm-agenda-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--bs-secondary-color, #6c757d);
    margin: 12px 0 6px;
}

    .tm-agenda-section-title:first-child {
        margin-top: 0;
    }

    .tm-agenda-section-title.is-overdue {
        color: var(--tm-danger, #dc2626);
    }

.tm-agenda-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background 0.15s ease;
}

    .tm-agenda-row:hover {
        background: var(--bs-secondary-bg, #f1f5f9);
    }

    .tm-agenda-row.is-completed {
        opacity: 0.5;
        text-decoration: line-through;
    }

.tm-agenda-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--tm-primary, #0d9488);
}

.tm-agenda-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tm-agenda-title {
    font-size: 0.95rem;
    color: var(--bs-body-color, #212529);
    line-height: 1.35;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tm-agenda-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--bs-secondary-color, #6c757d);
}

.tm-agenda-project {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.tm-agenda-project-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--tm-primary, #0d9488);
    flex-shrink: 0;
}

#todoAgendaModal .modal-title .tm-emoji {
    width: 1.4em;
    height: 1.4em;
    vertical-align: -0.3em;
}

/* ═══════════════════════════════════════════════════════════
   Floating panel — deadline vs todo distinction
   ═══════════════════════════════════════════════════════════ */

.floating-todo-title.is-deadline {
    color: var(--tm-primary, #0d9488);
}

.floating-todo-title.is-todo {
    color: var(--bs-body-color, #212529);
}

.floating-todo-type-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .floating-todo-type-dot.is-deadline {
        background: var(--tm-primary-subtle, #ccfbf1);
        border: 1px solid var(--tm-primary, #0d9488);
    }

        .floating-todo-type-dot.is-deadline::after {
            content: '';
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--tm-primary, #0d9488);
        }

.floating-todo-row[data-item-type="deadline"] {
    cursor: pointer;
}

    .floating-todo-row[data-item-type="deadline"]:hover {
        background: var(--bs-primary-bg-subtle, #e8f0fe);
    }

/* ═══════════════════════════════════════════════════════════
   Agenda popup - deadline rows
   ═══════════════════════════════════════════════════════════ */

.tm-agenda-type-dot {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tm-primary-subtle, #ccfbf1);
    border: 1px solid var(--tm-primary, #0d9488);
}

    .tm-agenda-type-dot::after {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--tm-primary, #0d9488);
    }

.tm-agenda-title.is-deadline {
    color: var(--tm-primary, #0d9488);
}

.tm-agenda-title.is-todo {
    color: var(--bs-body-color, #212529);
}

.tm-agenda-body[data-item-type="deadline"] {
    cursor: pointer;
}

.tm-agenda-row.is-completed {
    opacity: 0.5;
    text-decoration: line-through;
}

/* ─── Tracker start button inside a floating todo row ───── */

.floating-todo-start-btn {
    flex-shrink: 0;
    align-self: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--tm-primary, #0d9488);
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 120ms ease, transform 120ms ease;
}

    .floating-todo-start-btn:hover {
        background: var(--tm-primary-hover, #0f766e);
        transform: scale(1.08);
    }

    .floating-todo-start-btn:active {
        transform: scale(0.95);
    }