/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    width: 95%;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo {
    font-size: 3.5rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.description {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Main content */
.main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Button styles */
.btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 200px;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff5252, #d63031);
}

.btn-secondary {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #0984e3, #74b9ff);
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    min-width: auto;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
}

.loading-indicator.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #74b9ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-indicator p {
    color: #636e72;
    font-size: 1.1rem;
    margin: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Category Selection Styles */
.category-selection {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    max-width: 100%;
    width: 100%;
    margin-top: 2rem;
    animation: slideIn 0.5s ease-out;
}

.category-selection.hidden {
    display: none !important;
}

#challengeCategorySelection.hidden {
    display: none !important;
}

.category-selection h3 {
    color: #2d3436;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
}

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

.category-checkbox {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.category-checkbox:hover {
    background: #e9ecef;
    border-color: #74b9ff;
    transform: translateY(-2px);
}

.category-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.3s ease;
}

.category-checkbox input[type="checkbox"]:checked + .checkmark {
    background: #74b9ff;
    border-color: #74b9ff;
}

.category-checkbox input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.category-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Result styles */
.result {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    max-width: 100%;
    width: 100%;
    animation: slideIn 0.5s ease-out;
}

.result.hidden {
    display: none;
}

.result-content h3 {
    color: #2d3436;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.result-content div {
    color: #636e72;
    line-height: 1.7;
}

.result-content pre {
    background: #f8f9fa;
    color: #2d3436;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
    border-left: 4px solid #74b9ff;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-content code {
    background: #f1f2f6;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

/* Question and Answer Styles */
.question-section {
    margin-top: 1.5rem;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    border-left: 4px solid #74b9ff;
}

.answer-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #00b894;
    animation: slideIn 0.5s ease-out;
}

.answer-section.hidden {
    display: none !important;
}

.answer-content {
    color: #636e72;
    line-height: 1.7;
}

.answer-content h2,
.answer-content h3 {
    color: #2d3436;
    margin: 1rem 0 0.5rem 0;
}

.answer-content h2 {
    font-size: 1.3rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

.answer-content h3 {
    font-size: 1.1rem;
    color: #007bff;
}

.answer-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.answer-content li {
    margin: 0.25rem 0;
}

.answer-content pre {
    background: #2d3436;
    color: #ddd;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.answer-content code {
    background: #e9ecef;
    color: #d63384;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.answer-content strong {
    color: #2d3436;
    font-weight: 600;
}

.answer-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.answer-content h2 {
    margin: 1.5rem 0 1rem 0;
    font-size: 1.4rem;
    color: #2d3436;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

.answer-content h3 {
    margin: 1.2rem 0 0.8rem 0;
    font-size: 1.2rem;
    color: #007bff;
    font-weight: 600;
}

.answer-content ul {
    margin: 0.8rem 0;
    padding-left: 1.5rem;
}

.answer-content li {
    margin: 0.4rem 0;
    line-height: 1.5;
}

.answer-content pre {
    background: #f8f9fa;
    color: #2d3436;
    padding: 1.2rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.2rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid #dee2e6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.answer-content code {
    background: #e9ecef;
    color: #d63384;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 1px solid #dee2e6;
}

.answer-content blockquote {
    border-left: 4px solid #007bff;
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border-radius: 0 4px 4px 0;
}

.answer-content hr {
    border: none;
    border-top: 2px solid #e9ecef;
    margin: 2rem 0;
}

.reveal-section {
    margin-top: 1.5rem;
    text-align: center;
}

.btn-reveal {
    background: linear-gradient(135deg, #00b894, #00a085);
    color: white;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    min-width: 180px;
}

.btn-reveal:hover {
    background: linear-gradient(135deg, #00a085, #00b894);
    transform: translateY(-2px);
}

.countdown {
    padding: 1rem;
    background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
    border-radius: 12px;
    margin: 1rem 0;
    animation: pulse 1s infinite;
}

.countdown.hidden {
    display: none !important;
}

.btn-reveal.hidden {
    display: none !important;
}

.countdown-text {
    color: #2d3436;
    font-weight: 600;
    font-size: 1.1rem;
}

#countdownNumber {
    color: #e17055;
    font-weight: 700;
    font-size: 1.2rem;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        width: 98%;
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .description {
        font-size: 1rem;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .result {
        padding: 1.5rem;
    }
    
    .answer-content pre {
        font-size: 0.8rem;
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 2rem;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* Footer */
.footer {
    background: transparent;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.footer a {
    color: #ffd700;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #fff;
    text-decoration: underline;
}
