/**
 * ConvMaster - Stopwatch Styles
 * 
 * @package    ConvMaster
 * @version    1.0.0
 */

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tool-header__icon {
    font-size: 2.5rem;
}

.tool-header__icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
}

.tool-header__icon .icon--green {
    background: rgba(34, 197, 94, 0.15);
}

.tool-header__text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tool-header__text p {
    margin: 0;
    color: var(--text-secondary);
}

/* =====================================================
   STOPWATCH WIDGET
   ===================================================== */
.stopwatch-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 2rem;
}

/* =====================================================
   DATE DISPLAY
   ===================================================== */
.stopwatch-date {
    text-align: center;
    margin-bottom: 1.5rem;
}

.stopwatch-date__day {
    font-size: 0.9rem;
    font-weight: 600;
    color: #22c55e;
    text-transform: lowercase;
}

.stopwatch-date__full {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

/* =====================================================
   VIEW TABS
   ===================================================== */
.stopwatch-views {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    margin-bottom: 2rem;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.view-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.view-tab--active {
    color: #22c55e;
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-tab__icon {
    font-size: 1rem;
}

/* =====================================================
   STOPWATCH DISPLAY CONTAINER
   ===================================================== */
.stopwatch-display {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
    margin-bottom: 2rem;
}

/* =====================================================
   FLIP CLOCK DISPLAY (Scoped)
   ===================================================== */
.stopwatch-widget .stopwatch-flip-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.stopwatch-widget .stopwatch-flip-clock {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.stopwatch-widget .stopwatch-flip-clock__group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stopwatch-widget .stopwatch-flip-clock__digits {
    display: flex;
    gap: 4px;
}

.stopwatch-widget .stopwatch-flip-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 100px;
    background: linear-gradient(180deg, #2a2a35 0%, #1f1f28 49.9%, #18181f 50%, #1f1f28 100%);
    border-radius: 10px;
    font-size: 4rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.stopwatch-widget .stopwatch-flip-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0,0,0,0.4);
}

.stopwatch-widget .stopwatch-flip-card__digit {
    position: relative;
    z-index: 1;
}

/* Flip animation */
.stopwatch-widget .stopwatch-flip-card.flipping {
    animation: stopwatchFlipDigit 0.3s ease;
}

@keyframes stopwatchFlipDigit {
    0% { transform: perspective(200px) rotateX(0deg); }
    50% { transform: perspective(200px) rotateX(-90deg); }
    100% { transform: perspective(200px) rotateX(0deg); }
}

.stopwatch-widget .stopwatch-flip-clock__separator {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1.2rem;
}

.stopwatch-widget .stopwatch-flip-clock__label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* Milliseconds display */
.stopwatch-widget .stopwatch-flip-milliseconds {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 0.5rem;
}

.stopwatch-widget .stopwatch-flip-ms__value {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.stopwatch-widget .stopwatch-flip-ms__label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =====================================================
   DIGITAL DISPLAY (Scoped)
   ===================================================== */
.stopwatch-widget .stopwatch-digital-display {
    text-align: center;
}

.stopwatch-widget .stopwatch-digital-time {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stopwatch-widget .stopwatch-digital-time__main {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    font-size: 6rem;
    font-weight: 200;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}

.stopwatch-widget .stopwatch-digital-time__sep {
    opacity: 0.5;
}

.stopwatch-widget .stopwatch-digital-time__ms {
    font-family: 'DM Sans', monospace;
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
}

/* =====================================================
   ACTION BUTTONS
   ===================================================== */
.stopwatch-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stopwatch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.stopwatch-btn__icon {
    font-size: 1.1rem;
}

.stopwatch-btn--large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

.stopwatch-btn--primary {
    color: white;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #22c55e;
}

.stopwatch-btn--primary:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.stopwatch-btn--secondary {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.stopwatch-btn--secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.stopwatch-btn--outline {
    color: var(--text-primary);
    background: transparent;
    border-color: var(--border-color);
}

.stopwatch-btn--outline:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-muted);
}

.stopwatch-btn--accent {
    color: white;
    background: #3b82f6;
    border-color: #3b82f6;
}

.stopwatch-btn--accent:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.stopwatch-btn--ghost {
    color: var(--text-secondary);
    background: transparent;
    border-color: transparent;
    padding: 0.75rem;
}

.stopwatch-btn--ghost:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

/* =====================================================
   LAP TIMES SECTION
   ===================================================== */
.stopwatch-laps {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.stopwatch-laps__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.stopwatch-laps__header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.stopwatch-laps__actions {
    display: flex;
    gap: 0.5rem;
}

.stopwatch-laps__table {
    display: flex;
    flex-direction: column;
}

.stopwatch-laps__row {
    display: grid;
    grid-template-columns: 40px 50px 1fr 1fr 2fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
}

.stopwatch-laps__row--header {
    background: var(--bg-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stopwatch-laps__list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lap-item {
    display: grid;
    grid-template-columns: 40px 50px 1fr 1fr 2fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.6rem 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: background 0.15s ease;
}

.lap-item:hover {
    background: var(--bg-secondary);
}

.lap-col--action {
    text-align: center;
}

.lap-col--number {
    font-weight: 600;
    color: #22c55e;
}

.lap-col--time {
    font-family: 'DM Sans', monospace;
    font-weight: 500;
    color: var(--text-primary);
}

.lap-col--total {
    font-family: 'DM Sans', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lap-col--note {
    min-width: 0;
}

.lap-item__delete {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.lap-item__delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #ef4444;
}

.lap-item__note {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.15s ease;
}

.lap-item__note:focus {
    outline: none;
    border-color: #22c55e;
}

.lap-item__note::placeholder {
    color: var(--text-muted);
}

.lap-item--best .lap-col--time {
    color: #22c55e;
}

.lap-item--worst .lap-col--time {
    color: #ef4444;
}

/* =====================================================
   INLINE MESSAGE
   ===================================================== */
.stopwatch-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stopwatch-message--success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.stopwatch-message--error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.stopwatch-message--info {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* =====================================================
   INFO NOTICE
   ===================================================== */
.stopwatch-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stopwatch-info span {
    font-size: 1rem;
}

.stopwatch-info p {
    margin: 0;
}

/* =====================================================
   FULLSCREEN MODE
   ===================================================== */
.stopwatch-widget.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9998;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-primary);
}

.stopwatch-widget.fullscreen .stopwatch-display {
    min-height: auto;
    margin-bottom: 3rem;
}

.stopwatch-widget.fullscreen .stopwatch-flip-card {
    width: 120px;
    height: 170px;
    font-size: 7rem;
}

.stopwatch-widget.fullscreen .stopwatch-flip-clock__separator {
    font-size: 6rem;
    margin-top: 2rem;
}

.stopwatch-widget.fullscreen .stopwatch-digital-time {
    font-size: 10rem;
}

.stopwatch-widget.fullscreen .stopwatch-laps,
.stopwatch-widget.fullscreen .stopwatch-info,
.stopwatch-widget.fullscreen .stopwatch-views {
    display: none;
}

.stopwatch-widget.fullscreen .stopwatch-date {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.stopwatch-widget.fullscreen .stopwatch-actions {
    margin-top: 3rem;
}

/* =====================================================
   SEO CONTENT
   ===================================================== */
.tool-content {
    margin-top: 3rem;
}

.tool-section {
    margin-bottom: 2.5rem;
}

.tool-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

.tool-section > p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.feature-card__icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.step-card__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #22c55e;
    color: white;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.faq-item summary {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-muted);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.5rem 1rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* =====================================================
   HIDDEN ELEMENTS
   ===================================================== */
[hidden] {
    display: none !important;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .tool-page {
        padding: 1rem;
    }

    .stopwatch-widget {
        padding: 1.5rem 1rem;
    }

    .stopwatch-widget .stopwatch-flip-card {
        width: 50px;
        height: 75px;
        font-size: 2.8rem;
    }

    .stopwatch-widget .stopwatch-flip-clock__separator {
        font-size: 2.5rem;
        margin-top: 0.8rem;
    }

    .stopwatch-widget .stopwatch-flip-clock__label {
        font-size: 0.6rem;
    }

    .stopwatch-widget .stopwatch-digital-time__main {
        font-size: 3.5rem;
    }

    .stopwatch-widget .stopwatch-digital-time__ms {
        font-size: 1.5rem;
    }

    .stopwatch-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .stopwatch-btn--large {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }

    .view-tab__name {
        display: none;
    }

    /* Laps table responsive */
    .stopwatch-laps__row,
    .lap-item {
        grid-template-columns: 32px 40px 1fr 1fr;
    }
    
    .lap-col--note,
    .stopwatch-laps__row--header .lap-col--note {
        display: none;
    }

    .stopwatch-widget.fullscreen .stopwatch-flip-card {
        width: 60px;
        height: 90px;
        font-size: 3.5rem;
    }

    .stopwatch-widget.fullscreen .stopwatch-flip-clock__separator {
        font-size: 3rem;
        margin-top: 1rem;
    }

    .stopwatch-widget.fullscreen .stopwatch-digital-time__main {
        font-size: 5rem;
    }
}

@media (max-width: 480px) {
    .stopwatch-widget .stopwatch-flip-card {
        width: 42px;
        height: 65px;
        font-size: 2.3rem;
    }

    .stopwatch-widget .stopwatch-flip-clock__separator {
        font-size: 2rem;
        margin-top: 0.6rem;
    }

    .stopwatch-widget .stopwatch-digital-time {
        font-size: 2.5rem;
    }

    .stopwatch-actions {
        flex-direction: column;
        width: 100%;
    }

    .stopwatch-btn {
        width: 100%;
    }
}

/* =====================================================
   LIGHT THEME ADJUSTMENTS
   ===================================================== */
[data-theme="light"] .stopwatch-widget {
    background: var(--bg-card);
}

[data-theme="light"] .stopwatch-widget .stopwatch-flip-card {
    background: linear-gradient(180deg, #f8f8fc 0%, #e8e8f0 49.9%, #d8d8e0 50%, #e8e8f0 100%);
    color: #22c55e;
    text-shadow: none;
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.12),
        inset 0 1px 0 rgba(255,255,255,0.8),
        inset 0 -1px 0 rgba(0,0,0,0.08);
}

[data-theme="light"] .stopwatch-widget .stopwatch-flip-card::before {
    background: rgba(0,0,0,0.12);
}

[data-theme="light"] .stopwatch-widget .stopwatch-flip-clock__separator {
    color: #22c55e;
}

[data-theme="light"] .stopwatch-info {
    background: var(--bg-secondary);
}
