/**
 * TCG Timers - Stylesheet
 * Styles for timer banners, form, and color transitions
 */

/* Modern font family */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Container styles */
#tcg-timers-container {
    min-height: 100vh;
    height: 100vh;
    padding: 20px;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    overflow: hidden;
    box-sizing: border-box;
}

/* Logo container */
#tcg-logo-container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
    flex-shrink: 0;
}

#tcg-logo {
    max-width: 400px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Add button styles */
.tcg-add-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: transparent;
    color: #333333;
    font-size: 36px;
    font-weight: 300;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tcg-add-button:hover {
    background-color: transparent;
    border-color: #d0d0d0;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tcg-add-button:active {
    transform: scale(0.95);
}

/* Timers list container - Grid layout with 2 columns */
#tcg-timers-list {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    flex: 1;
    overflow: hidden;
    box-sizing: border-box;
    align-items: start;
    justify-items: stretch;
}

/* 1 timer: centered */
#tcg-timers-list:has(.tcg-timer-banner:nth-child(1):last-child) {
    grid-template-columns: 1fr;
    justify-items: center;
}

#tcg-timers-list:has(.tcg-timer-banner:nth-child(1):last-child) .tcg-timer-banner {
    max-width: 600px; /* Limit width for single timer */
}

/* 2 timers: stacked vertically (above each other) */
#tcg-timers-list:has(.tcg-timer-banner:nth-child(2):last-child) {
    grid-template-columns: 1fr;
    justify-items: stretch;
}

/* 3 timers: 2 side by side, 1 below centered */
#tcg-timers-list:has(.tcg-timer-banner:nth-child(3):last-child) {
    grid-template-columns: repeat(2, 1fr);
}

#tcg-timers-list:has(.tcg-timer-banner:nth-child(3):last-child) .tcg-timer-banner:nth-child(3) {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: calc(50% - 7.5px); /* Half width minus half gap */
}

/* 4 timers: 2 side by side, 2 below side by side (default grid behavior) */

/* Timer banner styles */
.tcg-timer-banner {
    width: 100%;
    max-height: 500px;
    min-height: 200px;
    padding: 0;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: height 0.3s ease, background-image 0.3s ease;
    flex-shrink: 0;
    position: relative;
    box-sizing: border-box;
    background: transparent;
    overflow: hidden;
    background-size: contain !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    cursor: pointer;
}

/* White background for timers without TCG type */
.tcg-timer-banner.tcg-timer-no-type {
    background: #ffffff !important;
}

/* Andere: no background, transparent */
.tcg-timer-banner.tcg-timer-andere {
    background: transparent !important;
    background-image: none !important;
}

.tcg-timer-banner.tcg-timer-andere[data-tcg-type="andere"]::before {
    background: transparent;
}

/* Background image overlay for better content visibility - stronger opacity for readability */
.tcg-timer-banner[data-tcg-type]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 0;
    pointer-events: none;
    transition: background 0.3s ease;
}

/* Light red overlay when timer is finished */
.tcg-timer-banner.timer-finished::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 215, 218, 0.6);
    z-index: 1;
    pointer-events: none;
}

.tcg-timer-banner[data-tcg-type] .tcg-timer-content {
    position: relative;
    z-index: 2;
}

/* Flickering and finished states - circle color handles visual feedback */
/* Background color removed - only circle shows progress */

/* Timer banner content */
.tcg-timer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    height: 100%;
    width: 100%;
    padding: 40px;
    padding-top: 70px; /* Extra top padding to account for title/buttons at top */
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    overflow: hidden; /* Prevent circle from overflowing */
}

.tcg-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    position: absolute;
    top: 15px;
    left: 15px;
    right: 120px; /* Space for reset button (36px) + delete button (36px) + gaps */
    z-index: 3;
}

.tcg-timer-title {
    font-size: 32px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    text-align: left;
    flex: 1;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
    flex-wrap: wrap;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tcg-countdown-to-start {
    font-size: 32px;
    font-weight: 600;
    color: #666666;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -0.5px;
}

/* Deep red color for "Round time finished" text when timer is finished */
.tcg-timer-banner.timer-finished .tcg-countdown-to-start {
    color: #8b0000;
}

.tcg-countdown-time {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.tcg-timer-display-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 3;
    overflow: hidden; /* Prevent circle from overflowing */
}

/* Circular timer container */
.tcg-circular-timer {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

/* SVG circle for progress ring */
.tcg-timer-circle {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start from top */
}

.tcg-timer-circle-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.1);
    stroke-width: 4;
}

.tcg-timer-circle-progress {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease, stroke 0.5s ease;
    /* stroke-dasharray and stroke-dashoffset will be set dynamically via JavaScript */
    stroke-dasharray: 879.65; /* Default: 2 * π * 140 (radius) - will be updated by JS */
    stroke-dashoffset: 879.65; /* Default: full circle hidden - will be updated by JS */
}

/* Block containing countdown and overtime subtext */
.tcg-timer-display-block {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 4;
}

/* Digital countdown inside circle */
.tcg-timer-display {
    font-size: 64px;
    font-weight: 900;
    font-family: 'Courier New', monospace;
    color: #1a1a1a;
    text-align: center;
    line-height: 1;
    letter-spacing: 2px;
}

/* Overtime: negative time in red */
.tcg-timer-display.tcg-timer-overtime {
    color: #dc3545;
}

/* Overtime subtext below countdown */
.tcg-overtime-subtext {
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: rgba(26, 26, 26, 0.7);
    text-align: center;
}

/* Overtime label - red bold text when timer goes negative */
.tcg-overtime-label {
    position: absolute;
    top: 65%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: 700;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #dc3545;
    text-align: center;
    z-index: 4;
}

/* Responsive circle size */
@media (max-width: 768px) {
    .tcg-circular-timer {
        width: 250px;
        height: 250px;
    }
    
    .tcg-timer-display {
        font-size: 48px;
    }
    
    .tcg-overtime-subtext {
        font-size: 12px;
    }
    
    .tcg-overtime-label {
        font-size: 22px;
    }
    
    .tcg-timer-circle-bg,
    .tcg-timer-circle-progress {
        stroke-width: 4;
    }
}

/* Timer controls - removed, buttons are now positioned absolutely */

/* Delete button */
.tcg-delete-button {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: transparent;
    border: 2px solid rgba(0, 0, 0, 0.15);
    color: #1a1a1a;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* Reset button - aligned with delete button */
.tcg-reset-button {
    position: absolute;
    top: 15px;
    right: 60px; /* Position next to delete button (36px width + 15px gap) */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: transparent;
    border: 2px solid rgba(0, 0, 0, 0.15);
    color: #dc3545;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.tcg-reset-button:hover {
    background-color: transparent;
    border-color: #dc3545;
    color: #dc3545;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.tcg-reset-button:active {
    transform: scale(0.95);
}

.tcg-delete-button:hover {
    background-color: transparent;
    border-color: #dc3545;
    color: #dc3545;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.tcg-delete-button:active {
    transform: scale(0.95);
}

.tcg-timer-button {
    padding: 12px 20px;
    font-size: 24px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1a1a1a;
    background-color: transparent;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    line-height: 1;
}

.tcg-timer-button:hover {
    transform: translateY(-2px);
    box-shadow: none;
}

.tcg-timer-button:active {
    transform: translateY(0);
}

/* Play/pause buttons removed - banner is now clickable */

.tcg-delete-button-main {
    background-color: transparent;
    border-color: #dc3545;
    color: #dc3545;
}

.tcg-delete-button-main:hover {
    background-color: transparent;
    border-color: #c82333;
    color: #c82333;
}

/* Form styles */
.tcg-timer-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 400px;
    display: none;
    border: 1px solid #e0e0e0;
}

.tcg-timer-form.active {
    display: block;
}

.tcg-form-group {
    margin-bottom: 25px;
}

.tcg-form-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.tcg-form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    color: #1a1a1a;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tcg-form-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.tcg-form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    background-color: #ffffff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    color: #1a1a1a;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.tcg-form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Time input styles */
.tcg-time-inputs {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    justify-content: center;
}

.tcg-time-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tcg-time-label {
    font-size: 14px;
    font-weight: 500;
    color: #666666;
    text-align: center;
    letter-spacing: -0.2px;
}

.tcg-number-input {
    width: 120px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    padding: 15px;
    appearance: textfield;
    -moz-appearance: textfield;
}

.tcg-number-input::-webkit-outer-spin-button,
.tcg-number-input::-webkit-inner-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

.tcg-time-separator {
    font-size: 32px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 8px;
    line-height: 1;
}

.tcg-form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

.tcg-form-button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: transparent;
}

.tcg-form-submit {
    background-color: transparent;
    border-color: #007bff;
    color: #007bff;
}

.tcg-form-submit:hover {
    background-color: transparent;
    border-color: #0056b3;
    color: #0056b3;
}

.tcg-form-cancel {
    background-color: transparent;
    border-color: #6c757d;
    color: #6c757d;
}

.tcg-form-cancel:hover {
    background-color: transparent;
    border-color: #5a6268;
    color: #5a6268;
}

/* Overlay for form */
.tcg-form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    backdrop-filter: blur(4px);
}

.tcg-form-overlay.active {
    display: block;
}

/* No background color - transparent background */

/* Responsive design */
@media (max-width: 768px) {
    #tcg-logo-container {
        flex-direction: column;
        gap: 15px;
    }
    
    #tcg-logo {
        max-width: 300px;
    }
    
    .tcg-add-button {
        width: 50px;
        height: 50px;
        font-size: 30px;
    }
    
    
    .tcg-timer-content {
        padding: 30px 20px;
        gap: 20px;
    }
    
    .tcg-title-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .tcg-timer-title {
        font-size: 24px;
        width: 100%;
    }
    
    .tcg-timer-display-wrapper {
        width: 100%;
    }
    
    .tcg-circular-timer {
        width: 200px !important;
        height: 200px !important;
    }
    
    .tcg-timer-display {
        font-size: 36px !important;
    }
    
    .tcg-overtime-subtext {
        font-size: 11px !important;
    }
    
    .tcg-overtime-label {
        font-size: 18px !important;
    }
    
    .tcg-timer-circle-bg,
    .tcg-timer-circle-progress {
        stroke-width: 8 !important;
    }
    
    .tcg-timer-controls {
        gap: 10px;
    }
    
    .tcg-timer-button {
        padding: 10px 15px;
        font-size: 20px;
        width: 50px;
        height: 50px;
    }
    
    .tcg-timer-form {
        min-width: 90%;
        padding: 30px 20px;
    }
    
    .tcg-time-inputs {
        gap: 10px;
    }
    
    .tcg-number-input {
        width: 100px;
        font-size: 20px;
        padding: 12px;
    }
    
    .tcg-time-separator {
        font-size: 24px;
    }
}

