/* ============================================================
   Pomodoro App - Ins Style UI
   ============================================================ */

:root {
    --pomo-primary: #ff6b6b;
    --pomo-primary-light: #ffe3e3;
    --pomo-bg: #fafafa;
    --pomo-card-bg: #ffffff;
    --pomo-text-main: #333333;
    --pomo-text-sub: #999999;
    --pomo-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --pomo-radius: 16px;
    --pomo-nav-height: 60px;
}

#pomodoroApp {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background: var(--pomo-bg);
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--pomo-text-main);
    overflow: hidden;
}

#pomodoroApp[style*="display: block"],
#pomodoroApp[style*="display: flex"] {
    display: flex !important;
}

/* --- Common Components --- */
.pomo-view {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: calc(var(--pomo-nav-height) + env(safe-area-inset-bottom, 0px) + 20px);
    animation: fadeIn 0.3s ease;
}

.pomo-view.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pomo-header {
    padding: 20px;
    font-size: 24px;
    font-weight: 700;
    background: var(--pomo-bg);
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pomo-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--pomo-text-main);
    transition: all 0.2s;
}

.pomo-btn-icon:active {
    transform: scale(0.95);
}

.pomo-card {
    background: var(--pomo-card-bg);
    border-radius: var(--pomo-radius);
    padding: 20px;
    margin: 0 20px 15px;
    box-shadow: var(--pomo-shadow);
    transition: transform 0.2s;
}

.pomo-card:active {
    transform: scale(0.98);
}

/* --- Navigation --- */
.pomo-nav {
    height: calc(var(--pomo-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    z-index: 50;
}

.pomo-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 10px;
    gap: 4px;
    flex: 1;
    height: 100%;
    cursor: pointer;
}

.pomo-nav-item i {
    font-size: 20px;
}

.pomo-nav-item.active {
    color: var(--pomo-primary);
}

/* --- Plan List View --- */
.pomo-plan-list {
    padding-bottom: 80px;
}

.pomo-plan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pomo-plan-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.pomo-plan-info p {
    margin: 0;
    font-size: 12px;
    color: var(--pomo-text-sub);
}

.pomo-add-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--pomo-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    cursor: pointer;
    z-index: 40;
    transition: transform 0.2s;
}

.pomo-add-btn:active {
    transform: scale(0.9);
}

/* --- Focus Setup View --- */
.pomo-setup-container {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.pomo-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--pomo-text-sub);
    margin-bottom: 10px;
}

.pomo-duration-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: #fff;
    padding: 30px;
    border-radius: var(--pomo-radius);
    box-shadow: var(--pomo-shadow);
}

.pomo-duration-display {
    font-size: 48px;
    font-weight: 800;
    color: var(--pomo-primary);
    width: 120px;
    text-align: center;
}

.pomo-duration-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #eee;
    background: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
}

.pomo-grid-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
}

.pomo-char-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.pomo-char-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #eee;
    background-size: cover;
    background-position: center;
    border: 3px solid transparent;
    transition: border-color 0.2s;
}

.pomo-char-item.selected .pomo-char-avatar {
    border-color: var(--pomo-primary);
}

.pomo-char-name {
    font-size: 12px;
    margin-top: 5px;
    color: var(--pomo-text-main);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.pomo-char-check {
    position: absolute;
    top: 0;
    right: 5px;
    background: var(--pomo-primary);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: none;
    align-items: center;
    justify-content: center;
}

.pomo-char-item.selected .pomo-char-check {
    display: flex;
}

.pomo-start-btn {
    background: var(--pomo-primary);
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
    cursor: pointer;
}

/* --- Focus Running View --- */
.pomo-running-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 40px 20px;
    background: #fff; 
}

.pomo-timer-circle {
    position: relative;
    width: 280px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pomo-progress-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.pomo-progress-circle {
    fill: none;
    stroke: var(--pomo-primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.pomo-focus-avatar {
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.pomo-focus-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.pomo-focus-avatar:active img {
    transform: scale(0.95);
}

.pomo-bubble {
    background: #fff;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    max-width: 80%;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    transform: scale(0.8);
}

.pomo-bubble.show {
    opacity: 1;
    transform: scale(1);
}

.pomo-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.pomo-running-time {
    font-size: 64px;
    font-weight: 200;
    color: var(--pomo-text-main);
    margin: 20px 0;
    font-variant-numeric: tabular-nums;
}

.pomo-controls-row {
    display: flex;
    gap: 30px;
}

.pomo-ctrl-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pomo-ctrl-btn.secondary {
    background: #f0f0f0;
    color: #666;
}

.pomo-ctrl-btn.primary {
    background: var(--pomo-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

/* --- Stats & Data --- */
.pomo-stats-summary {
    display: flex;
    padding: 20px;
    gap: 15px;
}

.pomo-stat-card {
    flex: 1;
    background: #fff;
    padding: 20px;
    border-radius: var(--pomo-radius);
    text-align: center;
    box-shadow: var(--pomo-shadow);
}

.pomo-stat-num {
    font-size: 28px;
    font-weight: 800;
    color: var(--pomo-primary);
    margin-bottom: 5px;
}

.pomo-stat-label {
    font-size: 12px;
    color: var(--pomo-text-sub);
}

.pomo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}

.pomo-table th {
    text-align: left;
    padding: 15px;
    color: var(--pomo-text-sub);
    font-weight: normal;
    border-bottom: 1px solid #f0f0f0;
}

.pomo-table td {
    padding: 15px;
    border-bottom: 1px solid #f5f5f5;
    color: var(--pomo-text-main);
}

.pomo-tab-header {
    display: flex;
    padding: 15px 20px 0;
    gap: 20px;
}

.pomo-tab-btn {
    font-size: 16px;
    font-weight: 600;
    color: var(--pomo-text-sub);
    padding-bottom: 10px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.pomo-tab-btn.active {
    color: var(--pomo-text-main);
    border-bottom-color: var(--pomo-primary);
}

.pomo-data-list {
    padding: 20px;
}

.pomo-music-item, .pomo-log-item {
    background: #fff;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.pomo-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.pomo-item-sub {
    font-size: 12px;
    color: #999;
}

/* --- Dialogs --- */
.pomo-drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.1);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 100;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.pomo-drawer.active {
    transform: translateY(0);
}

.pomo-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.pomo-drawer-title {
    font-size: 18px;
    font-weight: 700;
}

.pomo-drawer-content {
    flex: 1;
    overflow-y: auto;
}

.pomo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 90;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.pomo-overlay.active {
    display: block;
    opacity: 1;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Music Mini Player */
.pomo-mini-player {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 10px 20px;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 40;
    animation: fadeIn 0.3s;
}

.pomo-mini-player.active {
    display: flex;
}
