/* ================================================================
   BIOMAGNETISMO PARA TODOS — Toolkit Styles v1.0
   FAB, Tools Panel, Timer, Session, Favorites, Notes, Print
   ================================================================ */

/* =================== FAB =================== */
.tk-fab {
    position: fixed;
    right: 16px;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px) + 14px);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    z-index: 890;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tk-fab:hover { transform: scale(1.07); box-shadow: 0 10px 30px rgba(99,102,241,0.55); }
.tk-fab:active { transform: scale(0.96); }

.tk-fab-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #EF4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg, #fff);
}

/* =================== MINI FLOATING TIMER =================== */
.tk-mini-timer {
    position: fixed;
    right: 16px;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px) + 78px);
    padding: 8px 14px;
    border-radius: 22px;
    border: none;
    background: var(--bg-card, #fff);
    color: var(--text, #0F172A);
    font-size: 0.85rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    z-index: 890;
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border, #E2E8F0);
    animation: tkPulse 2s ease infinite;
}
.tk-mini-timer i { color: var(--primary, #6366F1); }
@keyframes tkPulse {
    0%, 100% { box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
    50% { box-shadow: 0 6px 24px rgba(99,102,241,0.4); }
}

/* =================== PANEL =================== */
.tk-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    z-index: 940;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.tk-panel-overlay.open { opacity: 1; pointer-events: auto; }

.tk-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 82vh;
    background: var(--bg-card, #fff);
    border-radius: 20px 20px 0 0;
    z-index: 950;
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.25);
}
.tk-panel.open { transform: translateY(0); }

@media (min-width: 720px) {
    .tk-panel {
        left: auto;
        right: 20px;
        bottom: 20px;
        width: 420px;
        max-height: 78vh;
        border-radius: 20px;
        transform: translateY(20px) scale(0.97);
        opacity: 0;
        pointer-events: none;
        transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .tk-panel.open { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
}

.tk-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 12px 0;
    border-bottom: 1px solid var(--border, #E2E8F0);
}

.tk-panel-tabs {
    flex: 1;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tk-panel-tabs::-webkit-scrollbar { display: none; }

.tk-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 6px 10px;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    color: var(--text-muted, #94A3B8);
    font-size: 0.68rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s;
}
.tk-tab i { font-size: 0.95rem; }
.tk-tab:hover { color: var(--text-secondary, #475569); }
.tk-tab.active { color: var(--primary, #6366F1); border-bottom-color: var(--primary, #6366F1); }

.tk-panel-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface, #F1F5F9);
    color: var(--text-secondary, #475569);
    cursor: pointer;
    flex-shrink: 0;
    margin-bottom: 8px;
    transition: background 0.15s;
}
.tk-panel-close:hover { background: var(--border, #E2E8F0); }

.tk-panel-body {
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
}

/* =================== TIMER CARD =================== */
.tk-timer-card {
    background: var(--bg-surface, #F1F5F9);
    border-radius: 14px;
    padding: 14px 16px;
    text-align: center;
    margin-bottom: 14px;
}
.tk-timer-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted, #94A3B8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.tk-timer-display {
    font-size: 2.6rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text, #0F172A);
    line-height: 1.2;
    margin: 4px 0 8px;
}
.tk-timer-chips {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.tk-timer-chip {
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid var(--border, #E2E8F0);
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #475569);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.tk-timer-chip:hover { border-color: var(--primary, #6366F1); }
.tk-timer-chip.active {
    background: var(--primary, #6366F1);
    border-color: var(--primary, #6366F1);
    color: #fff;
}
.tk-timer-btns { display: flex; gap: 8px; justify-content: center; }

/* =================== BUTTONS =================== */
.tk-btn {
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid var(--border, #E2E8F0);
    background: var(--bg-card, #fff);
    color: var(--text, #0F172A);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.15s;
}
.tk-btn:hover { border-color: var(--primary, #6366F1); color: var(--primary, #6366F1); }
.tk-btn-primary {
    background: var(--primary, #6366F1);
    border-color: var(--primary, #6366F1);
    color: #fff;
}
.tk-btn-primary:hover { background: #4F46E5; color: #fff; }
.tk-btn-green {
    background: #10B981;
    border-color: #10B981;
    color: #fff;
}
.tk-btn-green:hover { background: #059669; border-color: #059669; color: #fff; }
.tk-btn-danger-ghost {
    background: none;
    border-color: transparent;
    color: #EF4444;
    width: 100%;
}
.tk-btn-danger-ghost:hover { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.3); color: #EF4444; }

/* =================== LISTS =================== */
.tk-progress-line {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--green, #10B981);
    margin-bottom: 8px;
    text-align: center;
}
.tk-list { display: flex; flex-direction: column; gap: 6px; }

.tk-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    background: var(--bg-surface, #F1F5F9);
    border-radius: 10px;
    transition: opacity 0.2s;
}
.tk-item.done { opacity: 0.55; }
.tk-item.done .tk-item-name { text-decoration: line-through; }

.tk-item-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--green, #10B981);
    cursor: pointer;
    display: block;
}
.tk-item-star { color: #F59E0B; font-size: 0.85rem; }

.tk-item-name {
    flex: 1;
    text-align: left;
    background: none;
    border: none;
    color: var(--text, #0F172A);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    line-height: 1.35;
}
.tk-item-name:hover { color: var(--primary, #6366F1); }

.tk-item-remove {
    background: none;
    border: none;
    color: var(--text-muted, #94A3B8);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.tk-item-remove:hover { color: #EF4444; background: rgba(239,68,68,0.1); }

.tk-session-footer {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}
.tk-session-footer .tk-btn-green { flex: 1; }

/* =================== EMPTY STATE =================== */
.tk-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted, #94A3B8);
}
.tk-empty i { font-size: 2rem; margin-bottom: 10px; opacity: 0.5; }
.tk-empty p { font-size: 0.82rem; line-height: 1.5; margin: 0; }

/* =================== HISTORY =================== */
.tk-history-item {
    background: var(--bg-surface, #F1F5F9);
    border-radius: 10px;
    overflow: hidden;
}
.tk-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
}
.tk-history-head > i { color: var(--text-muted, #94A3B8); font-size: 0.75rem; }
.tk-history-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text, #0F172A);
    display: flex;
    align-items: center;
    gap: 6px;
}
.tk-history-date i { color: var(--primary, #6366F1); }
.tk-history-meta { font-size: 0.7rem; color: var(--text-muted, #94A3B8); margin-top: 2px; }
.tk-history-pairs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 0 12px 12px;
}
.tk-history-chip {
    font-size: 0.68rem;
    padding: 3px 9px;
    border-radius: 12px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border, #E2E8F0);
    color: var(--text-secondary, #475569);
}

/* =================== BACKUP =================== */
.tk-backup-desc {
    font-size: 0.82rem;
    color: var(--text-secondary, #475569);
    line-height: 1.5;
    margin: 0 0 14px;
}
.tk-backup-btns { display: flex; gap: 8px; margin-bottom: 16px; }
.tk-backup-btns .tk-btn { flex: 1; }
.tk-backup-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-surface, #F1F5F9);
    border-radius: 12px;
    padding: 12px 14px;
}
.tk-backup-stat {
    font-size: 0.8rem;
    color: var(--text-secondary, #475569);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tk-offline-note {
    font-size: 0.72rem;
    color: var(--text-muted, #94A3B8);
    text-align: center;
    margin: 14px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* =================== DETAIL ACTIONS ROW =================== */
.tk-actions {
    display: flex;
    gap: 6px;
    margin: 12px 0 4px;
    flex-wrap: wrap;
}
.tk-action-btn {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px 8px;
    border-radius: 12px;
    border: 1px solid var(--border, #E2E8F0);
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #475569);
    font-size: 0.62rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
}
.tk-action-btn i { font-size: 0.95rem; }
.tk-action-btn:hover { border-color: var(--primary, #6366F1); color: var(--primary, #6366F1); transform: translateY(-1px); }
.tk-action-btn.active-fav { border-color: #F59E0B; }
.tk-action-btn.active-fav i { color: #F59E0B; }
.tk-action-btn.active-note { border-color: var(--amber, #F59E0B); }
.tk-action-btn.active-note i { color: var(--amber, #F59E0B); }

/* Card fav star (catalog) */
.tk-card-fav {
    background: none;
    border: none;
    color: var(--text-muted, #94A3B8);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    margin-left: 6px;
    transition: all 0.15s;
    line-height: 1;
}
.tk-card-fav:hover { color: #F59E0B; transform: scale(1.15); }
.tk-card-fav.active i { color: #F59E0B; }

/* =================== NOTES =================== */
.tk-notes-box {
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
}
.tk-notes-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #94A3B8);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}
.tk-notes-area {
    width: 100%;
    min-height: 80px;
    border: 1px solid var(--border, #E2E8F0);
    border-radius: 8px;
    background: var(--bg-card, #fff);
    color: var(--text, #0F172A);
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 10px 12px;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}
.tk-notes-area:focus { border-color: var(--amber, #F59E0B); }

/* =================== DARK THEME =================== */
[data-theme="dark"] .tk-mini-timer { background: var(--bg-card); border-color: var(--border); }
[data-theme="dark"] .tk-fab-badge { border-color: var(--bg, #0F172A); }
[data-theme="dark"] .tk-notes-box { background: rgba(245, 158, 11, 0.08); }

/* =================== PRINT =================== */
@media print {
    body.tk-printing .header,
    body.tk-printing .bottom-nav,
    body.tk-printing .app-footer,
    body.tk-printing .sidebar-nav,
    body.tk-printing .sidebar-overlay,
    body.tk-printing .tk-fab,
    body.tk-printing .tk-mini-timer,
    body.tk-printing .tk-panel,
    body.tk-printing .tk-panel-overlay,
    body.tk-printing .tk-actions,
    body.tk-printing .detail-close-bar,
    body.tk-printing .diagram-zoom-hint,
    body.tk-printing #toast {
        display: none !important;
    }
    body.tk-printing .detail-overlay {
        position: static !important;
        overflow: visible !important;
        background: #fff !important;
    }
    body.tk-printing .detail-panel {
        max-height: none !important;
        box-shadow: none !important;
        transform: none !important;
    }
    body.tk-printing .detail-content { color: #000 !important; }
}
