/* ============================================
   POMODORO PRO - MAIN STYLES
   Version: 2.0
   Author: Kanpeki Universe
   Last updated: 2026-03-26
   ============================================ */

/* ============================================
   TABLE OF CONTENTS
   ============================================
   1.  CSS VARIABLES (THEMES)
   2.  RESET & BASE
   3.  LAYOUT (GRID SYSTEM)
   4.  COMPONENTS
       4.1. Timer & Progress
       4.2. Task Panel
       4.3. Date Panel
       4.4. Controls
   5.  SETTINGS & MODALS
   6.  UTILITIES
   7.  RESPONSIVE
   ============================================ */

/* ─── POMO CARD ──────────────────────────────────────────────── */
/* --------------------------------------------
   3. LAYOUT (GRID SYSTEM)
   --------------------------------------------
   Main structure of 3 columns:
   - Left: Timer + Sessions
   - Center: Task Input
   - Right: Date Panel
--------------------------------------------- */
.theme-notion{
    --bg-card: #000000;
    --bg-track: #aeadad;
    --text: #ffffff;
    --accent: #6c6c6c;
}

.theme-rose .progress-fill {
    --accent: #7C4552;
}

.theme-rose .task-title{
    --text-muted: #fff;
}

.theme-rose .task-input{
    --text: #fff;
}

.theme-rose .task-input {
    --accent2: #7C4552;
}

.pomo {
    background: var(--bg-card);
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 28px 24px 24px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas: 
      "tabs       task-input   date-large"
      "timer-ring task-input   date-large"
      "controls   task-input   date-large";
    gap: 20px;
    margin: auto;
  position: relative;
}

/* ─── TABS (top left area) ───────────────────────────────────── */
.tabs {
    grid-area: tabs;
    display: flex;
    gap: 4px;
    background: var(--bg-tabs);
    border-radius: 12px;
    padding: 4px;
    width: 100%;
    align-self: start;
}
.tab {
    flex: 1;
    padding: 7px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.tab.active {
    background: var(--tab-active-bg);
    color: var(--tab-active-c);
}

/* ─── Timer + Sessions + Progress Bar (left center) ──── */
.ring-sessions {
  grid-area: timer-ring;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
}

/* Container for time display */
.time-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}
.time {
    font-size: 72px;
    font-weight: 200;
    color: var(--text);
    letter-spacing: 3px;
    line-height: 1;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}
.mode-label {
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Sessions row */
.sessions { 
    display: flex; 
    align-items: center; 
    gap: 10px;
    justify-content: center;
}
.sessions span { 
    font-size: 11px; 
    color: var(--text-muted); 
}
.dots { 
    display: flex; 
    gap: 8px; 
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dot-empty);
    border: 1.5px solid var(--text-muted);
    transition: all 0.3s;
}
.dot.done { 
    background: var(--accent); 
    border-color: var(--accent); 
}

/* Progress Bar - Versión mejorada */
.progress-wrap { 
    width: 100%;
    max-width: 280px;
    margin-top: 8px;
}
.progress-track {
    width: 100%; 
    height: 6px;
    background: var(--bg-track);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

/**
 * Animated progress bar
 * 
 * @property {string} width - Controlled by JS (0% - 100%)
 * @property {color} background -It changes depending on the mode (Focus/Long break)
 */
.progress-fill {
    height: 100%;
    width: 0%; 
    background: var(--accent);
    border-radius: 10px;
    transition: width 0.3s linear;
    position: relative;
}
.progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 4px var(--accent);
}

/* ─── Task Input Panel (middle column) ───────────────────────── */
.task-panel {
    grid-area: task-input;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-self: start;
}

.task-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.task-title {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.task-count {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-track);
    border-radius: 20px;
    padding: 2px 8px;
    min-width: 24px;
    text-align: center;
}

/* Input row: text field + add button */
.task-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.task-input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    outline: none;
    transition: border-color 0.2s;
    border-bottom: 1px solid var(--accent2);
}
.task-input:focus { border-color: var(--btn-icon-b); }
.task-input::placeholder { color: var(--text-muted); opacity: 0.5; }

.btn-add-task {
  width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1.5px solid var(--btn-icon-b);
    background: transparent;
    color: var(--btn-icon-b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    flex-shrink: 0;
}
.btn-add-task:hover { background: var(--bg-track); }

/* Task list */
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.task-list::-webkit-scrollbar { width: 4px; }
.task-list::-webkit-scrollbar-track { background: transparent; }
.task-list::-webkit-scrollbar-thumb {
    background: var(--bg-track);
    border-radius: 2px;
}

.settings-panel::-webkit-scrollbar { width: 10px; }

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: var(--task-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: background 0.15s;
}
.task-item:hover { background: var(--task-hover); }
.task-item span {
    font-size: 12px;
    color: var(--text);
    flex: 1;
    line-height: 1.4;
    word-break: break-word;
}

.btn-remove-task {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.5;
    transition: all 0.15s;
}
.btn-remove-task:hover { opacity: 1; background: var(--bg-track); }

/* ─── Date Large Panel (right column) ────────────────────────── */
.date-large {
    grid-area: date-large;
    background: linear-gradient(135deg, var(--bg-track) 0%, var(--bg-card) 100%);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* min-height: 320px; */
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    font-family: 'Alaska', system-ui, sans-serif;
}

.date-large .day-name {
    font-size: 28px;
    font-weight: 500;
    letter-spacing: 2px;
    margin-bottom: 16px;
    color: var(--text);
}

.date-large .full-date {
    font-size: 56px;
    font-weight: 200;
    line-height: 1.2;
    margin-bottom: 12px;
    color: var(--text);
}

.date-large .month-year {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ─── Controls (bottom left area) ────────────────────────────── */
.controls-desktop {
    grid-area: controls;
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    padding-top: 12px;
}
.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--btn-icon-b);
    background: transparent;
    color: var(--btn-icon-b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
}
.btn-icon:hover { background: var(--bg-track); color: var(--text); border-color: var(--text); }

.btn-play-main {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--btn-play);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.btn-play-main:hover  { background: var(--btn-play-h); transform: scale(1.05); }
.btn-play-main.paused { background: var(--btn-pause); }
.btn-play-main.paused:hover { background: var(--btn-pause-h); }

.controls-mobile { display: none; }
.btn-fab {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: var(--btn-play);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
}
.btn-fab:hover { background: var(--btn-play-h); transform: scale(1.05); }
.btn-fab.paused { background: var(--btn-pause); }

/* ─── Settings button & panel ────────────────────────────────── */
.btn-copydbid {
    background: var(--bg-track-active);
    padding: 7px;
    border: 2px solid var(--accent2);
    color: var(--accent);
    border-radius: 7px;
}


.btn-settings {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--btn-icon-b);
    background: transparent;
    color: var(--btn-icon-b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
  z-index: 20;
}
.btn-settings:hover { background: var(--bg-track); }
.btn-settings svg { transition: transform 0.4s; }
.btn-settings.open svg { transform: rotate(60deg); }
.btn-copydbid:hover { background: var(--btn-play); }

.settings-panel {
    position: absolute;
    top: 56px;
    right: 12px;
    left: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 30;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.settings-panel.open { display: flex; }

.settings-section { 
    display: flex; 
    flex-direction:
    column; gap: 8px;
}

.settings-title {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 4px;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.input-group label {
    font-size: 11px;
    color: var(--text-muted);
    padding: 0 2px;
}
.input-group input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 11px;
    color: var(--text);
    font-family: 'Inter', monospace;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.input-group input:focus {
  border-color: var(--btn-icon-b);
}
.input-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 2px;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.4;
    transition: all 0.3s;
}
.status-dot.connected {
    background: #4ade80;
    opacity: 1;
}
.connection-status span {
    font-size: 11px;
    color: var(--text-muted);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
}
.theme-option:hover { background: var(--bg-track); }
.theme-option.active { background: var(--bg-track); }
.theme-option span { font-size: 12px; font-weight: 500; color: var(--text); }
.swatch { display: flex; gap: 3px; flex-shrink: 0; }
.swatch i { width: 10px; height: 10px; border-radius: 50%; display: block; }

/* ─── Toast notification ─────────────────────────────────────── */
.toast {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    background: var(--bg-track);
    border-radius: 0 0 24px 24px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10;
}
.toast.visible {
    opacity: 1;
    transform: translateY(0);
}
.toast.toast-success { color: #4ade80; }
.toast.toast-error { color: #f87171; }


.btn-connectwith-notion {
    background: var(--bg-track-active);
    padding: 7px;
    border: 2px solid var(--accent2);
    color: var(--accent);
    border-radius: 7px;
}
.btn-connectwith-notion:hover { background: var(--btn-play); cursor: pointer;}


/* Modal personalizado (funciona dentro de iframe) */
.logout-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.logout-modal-content {
  background: var(--bg-card, #13162A);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border, #2a2f4b);
}

.logout-modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.logout-modal-content h3 {
  color: var(--text, #C5C8D3);
  font-size: 20px;
  margin-bottom: 12px;
  font-weight: 600;
}

.logout-modal-content p {
  color: var(--text-muted, #7D6FB3);
  font-size: 14px;
  margin-bottom: 24px;
}

.logout-modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-logout-confirm {
  background: #EF4444;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-logout-confirm:hover {
  background: #DC2626;
  transform: scale(1.02);
}

.btn-logout-cancel {
  background: var(--bg-track, #242A46);
  color: var(--text, #C5C8D3);
  border: 1px solid var(--border, #2a2f4b);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-logout-cancel:hover {
  background: var(--border, #2a2f4b);
}

/* ─── Time Controls (botones +/-) ───────────────────────────── */
.time-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.btn-adjust-time {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-track);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-adjust-time:hover {
  background: var(--bg-track-active);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.08);
}

.btn-adjust-time:active {
  transform: scale(0.95);
}

/* Cursor pointer en el display para indicar que es clickeable */
.time {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  position: relative;
  user-select: none;
}

.time:hover {
  background: var(--bg-track);
  transform: scale(1.02);
}

/* Time Edit Input */
.time-edit-input {
  font-size: 72px;
  font-weight: 300;
  color: var(--text);
  background: var(--bg-track);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
  font-family: inherit;
  width: auto;
  max-width: 200px;
  transition: all 0.2s;
}

.time-edit-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(251, 196, 143, 0.2);
}

/* Hint para doble click */
.time::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

.time:hover::after {
  content: 'Double-click to edit';
  opacity: 0.7;
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE ADJUSTMENTS
   ───────────────────────────────────────────────────────────── */

/* Responsive adjustments ─────────────────────────────────────── */
.controls-desktop { display: flex; }
.controls-mobile { display: none; }
.date-large { display: none; }


/* Pantallas grandes (≥769px) - mostrar date-large */
@media (min-width: 769px) {
    .date-large { display: flex; }
    
    .pomo {
        grid-template-columns: 1fr 1.2fr 1fr;
        grid-template-areas: 
            "tabs       task-input   date-large"
            "timer-ring task-input   date-large"
            "controls   task-input   date-large";
        max-width: 1100px;
        padding: 28px 24px;
    }
}

/* Móviles estándar (≤768px) */
@media (max-width: 768px) {
    .pomo {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "tabs"
            "timer-ring"
            "task-input"
            "controls";
        gap: 20px;
        padding: 20px;
    }
    
    .date-large { display: none; }
    .time { font-size: 56px; }
}

/* Pantallas muy pequeñas (≤299px) - usar controles mobile */
@media (max-width: 299px) {
    .tabs { display: none; }
    .sessions { display: none; }
    .controls-desktop { display: none; }
    .controls-mobile { display: flex; }
    .time { font-size: 48px; }
}

/* Altura reducida (≤480px) con ancho suficiente - layout horizontal */
@media (max-height: 480px) and (min-width: 500px) {
    .pomo {
        grid-template-columns: 1fr 1.2fr 1fr;
        grid-template-areas: 
            "tabs       task-input   date-large"
            "timer-ring task-input   date-large"
            "controls   task-input   date-large";
        gap: 12px;
        padding: 16px 20px;
        max-width: 100%;
    }
    
    .date-large { display: flex; }
    .controls-desktop { display: flex; }
    .controls-mobile { display: none; }
    .time { font-size: 44px; }
    .task-list { max-height: 180px; }
    .settings-panel open {height: 200px;}
    #theme.settings-section{ height: 150px; overflow: auto;}
}

/* Altura reducida (≤480px) con ancho pequeño - layout vertical */
@media (max-height: 480px) and (max-width: 499px) {
    .pomo {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "timer-ring"
            "controls"
            "task-input";
        gap: 12px;
        padding: 12px;
    }
    
    .tabs { display: none; }
    .date-large { display: none; }
    .controls-desktop { display: none; }
    .controls-mobile { display: flex; }
    .time { font-size: 40px; }
    .task-list { max-height: 100px; }
    .settings-panel open {height: 200px;}
     #theme.settings-section { height: 200px; overflow: auto;}
}

/* Ajustes adicionales para alturas muy reducidas (≤430px) */
@media (max-height: 430px) and (min-width: 500px) {
    .time { font-size: 38px; }
    .task-list { max-height: 120px; }
    .btn-play-main { width: 48px; height: 48px; }
    .btn-icon { width: 34px; height: 34px; }
    .date-large .full-date { font-size: 28px; }
    .ring-sessions { gap: 8px; }
    .settings-panel open {height: 200px;}
     #theme.settings-section{ height: 150px; overflow: auto;}
}