/* Worldli - Geography SRS App Styles */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    color: #333;
    height: 100vh;
    overflow: hidden;
    /* PWA fullscreen support */
    height: 100dvh; /* Dynamic viewport height for mobile */
}

/* PWA safe area support for iOS notch/dynamic island */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

#question-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 1rem 2rem;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    /* PWA safe area support for top notch */
    padding-top: max(1rem, env(safe-area-inset-top));
}

#question-text {
    font-size: 2rem;
    font-weight: 600;
    margin: 0;
}

#progress-info {
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#reveal-button, #stats-button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#reveal-button {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

#reveal-button:hover:not(:disabled) {
    background-color: #ffecb3;
}

#stats-button:hover:not(:disabled) {
    background-color: #f5f5f5;
}

#reveal-button:disabled, #stats-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading state styles */
#question-text {
    transition: opacity 0.3s ease;
}

body.loading #question-text {
    opacity: 0.7;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.loading #progress-counter {
    animation: pulse 2s infinite;
}

/* Session End Overlay */
#session-end-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    text-align: center;
    max-width: 500px;
    width: 90vw;
}

#session-end-overlay.hidden {
    display: none;
}

#session-end-content h2 {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.8rem;
}

#session-end-content p {
    margin: 0.5rem 0;
    color: #666;
    font-size: 1.1rem;
    line-height: 1.5;
}

#session-end-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.primary-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.primary-button:hover {
    background: #0056b3;
}

.secondary-button {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #dee2e6;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.secondary-button:hover {
    background: #e9ecef;
}

/* Session Summary */
.session-summary {
    margin: 1.5rem 0;
    text-align: left;
}

.summary-section {
    margin-bottom: 1rem;
}

.summary-section h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
}

.flag-grid {
    font-size: 1.5rem;
    line-height: 1.4;
    letter-spacing: 0.2rem;
}

.interactive-flag {
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
    display: inline-block;
    margin: 0 0.1rem;
}

.interactive-flag:hover {
    transform: scale(1.2);
}

#map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    /* PWA safe area support for bottom home indicator */
    padding-bottom: env(safe-area-inset-bottom);
}

#feedback-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    z-index: 2000;
    text-align: center;
    min-width: 200px;
}

#feedback-overlay.hidden {
    display: none;
}

#feedback-result {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#feedback-time {
    font-size: 1rem;
    opacity: 0.8;
}

#feedback-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
}

#feedback-info.hidden {
    display: none;
}

#country-capital {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ffd700;
}

#country-details {
    opacity: 0.9;
    line-height: 1.4;
}

/* Dialog Styles */
#stats-dialog {
    max-width: 900px;
    width: 95vw;
    max-height: 90vh;
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 0;
    overflow: hidden;
    margin: auto;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#stats-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

#stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

#stats-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

#stats-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    color: #666;
}

#stats-close:hover {
    background-color: #e9ecef;
    color: #333;
}

#stats-content {
    padding: 2rem;
    overflow-y: auto;
}

#stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

#stats-breakdown {
    margin-bottom: 2rem;
}

#stats-breakdown h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

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

.breakdown-item {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid;
}

.breakdown-item.new {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.breakdown-item.learning {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
}

.breakdown-item.review {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.breakdown-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.breakdown-count {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
}

#stats-schedule h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

#schedule-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
}

.schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.schedule-item:last-child {
    border-bottom: none;
}

.schedule-country {
    font-weight: 500;
}

.schedule-date {
    font-size: 0.9rem;
    color: #666;
}

.schedule-ease {
    font-size: 0.8rem;
    color: #999;
}