/* TallyCounter.css - Calculator-specific styles only */
/* Reference: MDN Vibration API (https://developer.mozilla.org/en-US/docs/Web/API/Vibration_API) */
/* Reference: MDN Web Audio API (https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API) */
/* Reference: MDN Fullscreen API (https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API) */
/* Verified: 2025-11-28 | Vibration: Android only, iOS not supported */

/* ============================================
   Main Tap Area
   ============================================ */
.tap-area {
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    transition: all 0.2s ease;
}

.tap-area:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.tap-area:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
}

/* Counter Display */
.counter-display {
    font-size: 8rem;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    transition: transform 0.15s ease;
}

.counter-display.pulse {
    animation: counterPulse 0.15s ease;
}

@keyframes counterPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Tap Hint */
.tap-hint {
    font-size: 1rem;
    color: #718096;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tap-hint i {
    color: #667eea;
}

/* Loops Display (達成次數) */
.loops-display {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(249, 115, 22, 0.15) 100%);
    border-radius: 30px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #d97706;
    border: 2px solid rgba(245, 158, 11, 0.3);
}

.loops-display.visible {
    display: flex;
}

.loops-display i {
    color: #f59e0b;
    font-size: 1.2rem;
}

.loops-display #loopsCount {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.3);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Goal Reached Animation */
.goal-reached {
    animation: goalCelebrate 0.5s ease;
}

@keyframes goalCelebrate {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.02); }
    50% { transform: scale(0.98); }
    75% { transform: scale(1.01); }
}

/* ============================================
   Fullscreen Mode
   ============================================ */
#counterCard {
    transition: all 0.3s ease;
}

#counterCard.fullscreen-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
}

#counterCard.fullscreen-mode .tap-area {
    flex: 1;
    min-height: auto;
    background: transparent;
    border-radius: 0;
}

#counterCard.fullscreen-mode .tap-area:hover {
    background: transparent;
}

#counterCard.fullscreen-mode .tap-area:active {
    transform: none;
    background: rgba(102, 126, 234, 0.1);
}

#counterCard.fullscreen-mode .counter-display {
    font-size: 15rem;
    background: linear-gradient(135deg, #667eea 0%, #a78bfa 50%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#counterCard.fullscreen-mode .tap-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
}

#counterCard.fullscreen-mode .tap-hint i {
    color: #a78bfa;
}

#counterCard.fullscreen-mode .loops-display {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(249, 115, 22, 0.2) 100%);
    border-color: rgba(245, 158, 11, 0.4);
    font-size: 1.3rem;
    padding: 12px 30px;
}

#counterCard.fullscreen-mode .loops-display i {
    font-size: 1.5rem;
}

#counterCard.fullscreen-mode .loops-display #loopsCount {
    font-size: 1.8rem;
}

#counterCard.fullscreen-mode .progress-container {
    margin: 20px auto 0;
    max-width: 600px;
    width: 100%;
}

#counterCard.fullscreen-mode .progress-bar-wrapper {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
}

#counterCard.fullscreen-mode .progress-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
}

/* Fullscreen Exit Button (hidden by default) */
.exit-fullscreen-btn {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.exit-fullscreen-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: scale(1.1);
}

.exit-fullscreen-btn:active {
    transform: scale(0.95);
}

#counterCard.fullscreen-mode .exit-fullscreen-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Fullscreen Controls (hidden by default) */
.fullscreen-controls {
    display: none;
    padding: 20px;
    margin-top: auto;
}

.fullscreen-controls.visible {
    display: block;
}

#counterCard.fullscreen-mode .fullscreen-controls .control-btn {
    padding: 20px 30px;
    font-size: 1.5rem;
}

/* Fullscreen Button */
.fullscreen-btn {
    font-size: 1.1rem;
    padding: 15px 25px;
}

.fullscreen-btn i {
    margin-right: 8px;
}

/* ============================================
   Settings & Controls
   ============================================ */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    color: #4a5568;
}

.settings-label i {
    color: #667eea;
    width: 20px;
    text-align: center;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 56px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(28px);
}

/* Control Buttons */
.control-btn {
    padding: 15px 25px;
    font-size: 1.2rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.control-btn-minus {
    background: linear-gradient(135deg, #fc8181 0%, #f56565 100%);
    color: white;
}

.control-btn-minus:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.4);
}

.control-btn-reset {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%);
    color: white;
}

.control-btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(113, 128, 150, 0.4);
}

.control-btn-plus {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.control-btn-plus:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.control-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Target Input */
.target-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.target-select {
    min-width: 120px;
}

.custom-target-input {
    width: 100px;
    display: none;
}

.custom-target-input.visible {
    display: block;
}

/* Progress Bar (when target is set) */
.progress-container {
    margin-top: 15px;
    display: none;
}

.progress-container.visible {
    display: block;
}

.progress-bar-wrapper {
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #718096;
}

/* Shortcuts Info */
.shortcuts-info {
    font-size: 0.85rem;
    color: #718096;
    padding: 10px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
}

.shortcuts-info code {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 767px) {
    .tap-area {
        min-height: 300px;
    }

    .counter-display {
        font-size: 5rem;
    }

    .tap-hint {
        font-size: 0.9rem;
    }

    .control-btn {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .settings-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .target-input-wrapper {
        width: 100%;
        justify-content: flex-end;
    }

    .loops-display {
        font-size: 0.95rem;
        padding: 6px 15px;
    }

    .loops-display #loopsCount {
        font-size: 1.2rem;
    }

    /* Fullscreen Mobile */
    #counterCard.fullscreen-mode .counter-display {
        font-size: 6rem;
    }

    #counterCard.fullscreen-mode .fullscreen-controls .control-btn {
        padding: 15px 20px;
        font-size: 1.2rem;
    }

    #counterCard.fullscreen-mode .loops-display {
        font-size: 1rem;
        padding: 8px 20px;
    }

    #counterCard.fullscreen-mode .loops-display #loopsCount {
        font-size: 1.3rem;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .counter-display {
        font-size: 6rem;
    }

    #counterCard.fullscreen-mode .counter-display {
        font-size: 10rem;
    }
}

/* ============================================
   Dark Theme Support (if needed in future)
   ============================================ */
@media (prefers-color-scheme: dark) {
    .tap-area {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    }
}
