/* ===== CSS RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100dvh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) calc(env(safe-area-inset-bottom) + 16px) env(safe-area-inset-left);
    color: var(--text-color);
    background: var(--background-color) var(--background-image, url('bayrak.jpg')) center/cover no-repeat;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Lazy loading styles */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

img.loaded {
    opacity: 1;
    background: none;
    animation: none;
}

img.error {
    opacity: 0.5;
    background: #f5f5f5;
    animation: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Background image loading transition */
body {
    transition: background-image 0.5s ease;
}

/* File upload loading state */
.file-upload-label {
    transition: opacity 0.3s ease;
}

/* ===== NOTIFICATION SYSTEM ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 400px;
    padding: 0;
    border-radius: var(--card-radius, 12px);
    box-shadow: var(--card-shadow, 0 8px 32px rgba(0, 0, 0, 0.1));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.notification-icon {
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.notification-message {
    flex: 1;
    word-wrap: break-word;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    color: inherit;
    opacity: 0.7;
}

.notification-close:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.notification-close:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Notification types */
.notification.success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(21, 128, 61, 0.9));
    color: white;
}

.notification.success .notification-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: #dcfce7;
}

.notification.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(185, 28, 28, 0.9));
    color: white;
}

.notification.error .notification-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fecaca;
}

.notification.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(180, 83, 9, 0.9));
    color: white;
}

.notification.warning .notification-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fef3c7;
}

.notification.info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(29, 78, 216, 0.9));
    color: white;
}

.notification.info .notification-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: #dbeafe;
}

.notification.loading {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.9), rgba(75, 85, 99, 0.9));
    color: white;
}

.notification.loading .notification-icon {
    background-color: rgba(255, 255, 255, 0.2);
    color: #f3f4f6;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Multiple notifications stacking */
.notification:nth-child(n+2) {
    margin-top: 8px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .notification {
        left: 20px;
        right: 20px;
        min-width: auto;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .notification-content {
        padding: 12px;
        gap: 8px;
    }
    
    .notification-message {
        font-size: 13px;
    }
}

/* Focus styles for better keyboard navigation */
*:focus {
    outline: 2px solid var(--accent-primary, #4aa8ff);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--card-background);
    color: var(--text-color);
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-color: #000000;
        --background-color: #ffffff;
        --card-background: #f0f0f0;
        --card-border: #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== LAYOUT COMPONENTS ===== */
.container {
    text-align: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: 0 16px;
}

.title-block {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    padding: 10px 20px;
    border-radius: var(--card-radius);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: var(--card-background);
    box-shadow: var(--card-shadow);
}

.block {
    border-radius: var(--card-radius);
    padding: 12px;
    margin: 6px auto;
    width: 100%;
    max-width: 320px;
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: var(--card-background);
    box-shadow: var(--card-shadow);
}
/* ===== TYPOGRAPHY ===== */
.count {
    font-size: clamp(32px, 8vw, 56px);
    font-weight: 800;
    letter-spacing: 1px;
    line-height: 1.1;
}

.unit {
    font-size: clamp(12px, 3.5vw, 16px);
    opacity: 0.9;
    line-height: 1.2;
}
/* ===== BUTTONS ===== */
.settings-button {
    position: fixed;
    top: 12px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1877F2, #42A5F5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
}

.settings-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(24, 119, 242, 0.4);
}

.settings-button img,
.settings-button svg {
    width: 24px;
    height: 24px;
    color: white;
}
/* ===== POPUP STYLES - Ana Uygulama Tasarımına Uygun ===== */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.popup-content {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    color: var(--text-color, #333);
    border: 1px solid var(--card-border, #e0e0e0);
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--card-border, #e0e0e0);
    background: linear-gradient(135deg, #1877F2, #42A5F5);
    color: white;
}

.popup-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.popup-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.popup-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.popup-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.popup-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--card-border, #e0e0e0);
    background: var(--card-bg, #f8f9fa);
}

/* ===== FORM STYLES ===== */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color, #333);
    font-size: 14px;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--card-border, #e0e0e0);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s;
    background: var(--card-bg, #ffffff);
    color: var(--text-color, #333);
    box-sizing: border-box;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #1877F2;
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.1);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* ===== BUTTON STYLES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    min-height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, #1877F2, #42A5F5);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e0e0e0;
    flex: 1;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #d0d0d0;
}

.btn-outline {
    background: transparent;
    color: #1877F2;
    border: 2px solid #1877F2;
}

.btn-outline:hover {
    background: #1877F2;
    color: white;
}

/* ===== FILE UPLOAD STYLES ===== */
.file-upload-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

#popupBackgroundImage {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1877F2, #42A5F5);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    border: 2px solid transparent;
}

.file-upload-label:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.3);
}

.thumbnail-container {
    margin-top: 12px;
    text-align: center;
}

.thumbnail-container img {
    max-width: 100%;
    max-height: 120px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 480px) {
    .popup-content {
        width: 95%;
        margin: 20px auto;
        max-height: 85vh;
    }
    
    .popup-header {
        padding: 16px 20px 12px;
    }
    
    .popup-body {
        padding: 20px;
    }
    
    .popup-footer {
        padding: 12px 20px 20px;
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .btn {
        width: 100%;
    }
}
.file-upload-container {
    display: inline-block;
    position: relative;
}

.file-upload-label {
    background: linear-gradient(135deg, #4aa8ff, #7ed2ff);
    padding: 10px 12px;
    border-radius: var(--card-radius, 12px);
    cursor: pointer;
    display: inline-block;
    margin-left: -5px;
    color: #0b0f17;
    font-weight: 700;
}

#popupBackgroundImage {
    display: none; /* Dosya seçme düğmesini gizler */
}

.file-upload-label:hover {
    filter: brightness(1.05);
}
#countdown {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: center;
    align-items: stretch;
    width: 100%;
    padding: 0 6px; /* İç boşlukla ufak yuvarlama taşmalarını engelle */
}
#countdown .block {
    flex: 1 1 0;
    max-width: none;
    margin: 0;
    min-width: 0; /* Flex shrink için içerik genişliğini zorlamayı engelle */
    border-radius: var(--card-radius, 14px);
}
#countdown .count {
    font-size: clamp(16px, 5.2vw, 28px);
}
#countdown .unit {
    font-size: clamp(10px, 2.8vw, 12px);
}
.activation-block {
    position: fixed;
    bottom: 50%;
    right: 50%;
    transform: translate(50%, 50%);
    color: var(--text-color);
    padding: 12px 14px;
    border-radius: var(--card-radius, 16px);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: color-mix(in oklab, var(--card-bg) 70%, transparent);
    box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
#cityBlock {
    border-radius: var(--card-radius);
    padding: 12px;
    margin: 5px auto;
    width: 100%;
    text-align: center;
    display: none;
    font-weight: 800;
    font-size: clamp(18px, 4.5vw, 22px);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: var(--card-background);
    box-shadow: var(--card-shadow);
}

#cityBlock .count {
    font-size: 1.5em;
}

/* ===== PROGRESS BAR ===== */
.progress {
    width: 100%;
    max-width: 420px;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--card-background);
    box-shadow: inset 0 0 0 1px var(--card-border);
    margin: 8px auto 0;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.3s ease;
}

/* ===== CSS VARIABLES & THEMES ===== */
:root {
    /* Base Design Tokens */
    --card-radius: 16px;
    --card-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    --button-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    
    /* Default Theme (Glass) */
    --text-color: #eef2f7;
    --background-color: #0b0f17;
    --card-background: color-mix(in oklab, #1b2433 70%, transparent);
    --card-border: color-mix(in oklab, #1b2433 85%, transparent);
    --accent-primary: #4aa8ff;
    --accent-secondary: #7ed2ff;
}

.theme-glass {
    --text-color: #eef2f7;
    --background-color: #0b0f17;
    --card-background: color-mix(in oklab, #1b2433 70%, transparent);
    --card-border: color-mix(in oklab, #1b2433 85%, transparent);
}

.theme-neumorph {
    --text-color: #0e1320;
    --background-color: #e8ecf3;
    --card-background: #eef2f7;
    --card-border: transparent;
    --card-shadow: 6px 6px 14px #cdd3dd, -6px -6px 14px #ffffff;
}

.theme-minimal {
    --text-color: #e6e6e6;
    --background-color: #000000;
    --card-background: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.12);
    --card-shadow: none;
}

.theme-aurora {
    --text-color: #f0f7ff;
    --background-color: #050b1a;
    --card-background: color-mix(in oklab, #0b1530 70%, transparent);
    --card-border: color-mix(in oklab, #0b1530 85%, transparent);
    --accent-primary: #60a5fa;
    --accent-secondary: #34d399;
    --gradient: radial-gradient(1200px 600px at 10% 10%, #2dd4bf22, transparent 60%),
                radial-gradient(1000px 800px at 90% 20%, #60a5fa22, transparent 60%),
                radial-gradient(800px 900px at 40% 80%, #a78bfa22, transparent 60%);
}

.theme-sunset {
    --text-color: #fff7f2;
    --background-color: #16060b;
    --card-background: color-mix(in oklab, #2b0f19 70%, transparent);
    --card-border: color-mix(in oklab, #2b0f19 85%, transparent);
    --accent-primary: #ff8a5b;
    --accent-secondary: #ff3d68;
    --gradient: radial-gradient(900px 700px at 20% 20%, #ff8a5b26, transparent 60%),
                radial-gradient(1000px 800px at 80% 30%, #ff3d6820, transparent 60%),
                radial-gradient(800px 1000px at 50% 90%, #ffd1661a, transparent 60%);
}

.theme-oled {
    --text-color: #f5f5f5;
    --background-color: #000000;
    --card-background: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.14);
    --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ===== THEME SPECIFIC OVERRIDES ===== */
.theme-minimal .block,
.theme-minimal .title-block,
.theme-minimal #cityBlock,
.theme-minimal .settings-button {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.theme-minimal .popup-content {
    background-color: #0b0b0b;
    border: 1px solid var(--card-border);
}

.theme-minimal .popup-button,
.theme-minimal .file-upload-label {
    background: var(--text-color);
    color: var(--background-color);
}

.theme-minimal .progress {
    background: var(--card-background);
    box-shadow: inset 0 0 0 1px var(--card-border);
}

.theme-minimal .progress-fill {
    background: var(--text-color);
}

.theme-neumorph .block,
.theme-neumorph .title-block,
.theme-neumorph #cityBlock,
.theme-neumorph .settings-button {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.theme-neumorph .popup-content {
    background: var(--card-background);
    color: var(--text-color);
}

.theme-neumorph .popup-button,
.theme-neumorph .file-upload-label {
    background: var(--text-color);
    color: var(--background-color);
}

.theme-neumorph .progress {
    background: #dfe5ee;
    box-shadow: inset 6px 6px 12px #cdd3dd, inset -6px -6px 12px #ffffff;
}

.theme-neumorph .progress-fill {
    background: var(--text-color);
}

/* ===== GRADIENT THEMES ===== */
.theme-aurora body,
body.theme-aurora {
    background-image: var(--background-image), var(--gradient);
    background-blend-mode: normal, screen;
}

.theme-sunset body,
body.theme-sunset {
    background-image: var(--background-image), var(--gradient);
    background-blend-mode: normal, screen;
}

/* ===== ACCENT COLORS ===== */
.theme-aurora .popup-button,
.theme-aurora .file-upload-label {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #081018;
}

.theme-aurora .progress-fill {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.theme-sunset .popup-button,
.theme-sunset .file-upload-label {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #22060b;
    font-weight: 800;
}

.theme-sunset .progress-fill {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.theme-oled .popup-content {
    background: #050505;
    border: 1px solid var(--card-border);
}

.theme-oled .popup-button,
.theme-oled .file-upload-label {
    background: var(--text-color);
    color: var(--background-color);
}

.theme-oled .progress {
    background: var(--card-background);
    box-shadow: inset 0 0 0 1px var(--card-border);
}

.theme-oled .progress-fill {
    background: var(--text-color);
}
