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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

/* Container styles - responsive height based on context */
.container {
    width: 100%;
    max-width: 800px;
    height: 450px; /* Default iframe height */
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Adjust height for full browser view */
@media (min-height: 600px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
        max-height: 800px;
    }
}

/* Progress indicator */
.progress-container {
    padding: 20px 30px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 20%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

/* Question container */
.question-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.question-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.question-card.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.question-card.prev {
    transform: translateX(-100px);
}

.question-title {
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    text-align: center;
}

.question-subtitle {
    font-size: 16px;
    color: #718096;
    text-align: center;
    margin-bottom: 30px;
}

/* Input styles for text inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

.word-input {
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
}

.word-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.word-input:hover {
    border-color: #cbd5e0;
}

/* Option button styles */
.option-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.option-btn {
    padding: 16px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 16px;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    min-height: 56px;
    display: flex;
    align-items: center;
    width: 100%;
}

.option-btn:hover {
    border-color: #667eea;
    background: #f7fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.option-btn.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Navigation buttons */
.nav-container {
    padding: 20px 30px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.nav-btn {
    padding: 12px 24px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    height: 48px;
}

.nav-btn:hover:not(:disabled) {
    border-color: #667eea;
    background: #f7fafc;
}

.nav-btn.primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
}

.nav-btn.primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 24px 30px 16px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #2d3748;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #718096;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f7fafc;
    color: #2d3748;
}

.modal-content {
    padding: 24px 30px;
    line-height: 1.6;
}

.modal-footer {
    padding: 16px 30px 24px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.restart-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.restart-btn:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Tooltip styles */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1001;
    max-width: 200px;
    text-align: center;
}

/* Personality insight styles */
.insight-section {
    margin-bottom: 24px;
}

.insight-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insight-section p {
    color: #4a5568;
    margin-bottom: 8px;
}

.trait-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.trait-tag {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        margin: 5px;
        border-radius: 12px;
    }
    
    .question-card {
        padding: 20px;
    }
    
    .question-title {
        font-size: 20px;
    }
    
    .question-subtitle {
        font-size: 14px;
    }
    
    .option-btn {
        padding: 14px 18px;
        font-size: 15px;
    }
    
    .nav-container {
        padding: 15px 20px;
    }
    
    .progress-container {
        padding: 15px 20px 8px;
    }
}

/* Touch-friendly interactions */
@media (hover: none) {
    .option-btn:hover {
        transform: none;
        box-shadow: none;
    }
    
    .nav-btn:hover:not(:disabled) {
        transform: none;
    }
    
    .word-input:hover {
        border-color: #e2e8f0;
    }
}