@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Assistant', sans-serif;
}

html[dir="rtl"] #quiz-container,
html[dir="rtl"] #finish-container,
html[dir="rtl"] #welcome-container {
    text-align: right;
}

html[dir="rtl"] .answer-option {
    direction: rtl;
}

html[dir="rtl"] .answer-rank {
    margin-right: 1rem;
    margin-left: 0;
}

html[dir="rtl"] #answers-summary,
html[dir="rtl"] .answer-summary-item {
    text-align: right;
}

html[dir="rtl"] .answer-summary-item ol {
    padding-right: 20px;
    padding-left: 0;
    list-style-position: inside;
}

html[dir="rtl"] .close-btn {
    left: auto;
    right: 0.5rem;
}

html[dir="rtl"] .pop-up-content {
    text-align: right;
}

html[dir="rtl"] #pop-up-text {
    padding-right: 0;
    padding-left: 1rem;
}


body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #F0FDF4; /* Light Green */
    color: #1A202C; /* Dark Gray */
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    background-color: #5cb85c;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.btn:hover {
    background-color: #4cae4c;
}

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background-color: #6c757d;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.answer-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #5cb85c, #4cae4c);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    margin-right: 0;
    box-shadow: 0 2px 8px rgba(92, 184, 92, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-width: 36px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.answer-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #2c3e50;
    line-height: 1.4;
    flex: 1;
}

.drag-handle {
    display: none; /* Hidden by default on desktop */
}

/* Mobile-only drag handle styles will be defined in mobile section */

/* Microsoft Forms style dragging states */
.answer-option.touch-preparing {
    transform: scale(0.98);
    transition: transform 0.1s cubic-bezier(0.2, 0, 0, 1);
}

.answer-option.dragging {
    opacity: 0.8;
    transform: translate3d(0, 0, 0) scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(16, 185, 129, 0.1);
    background: linear-gradient(135deg, #ffffff, #f8fff9);
    border-color: rgba(16, 185, 129, 0.3);
    z-index: 1000;
    transition: none; /* No transition during drag for immediate response */
    will-change: transform;
}

.answer-option.placeholder {
    opacity: 0.3;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border: 2px dashed #cbd5e1;
    transform: translate3d(0, 0, 0) scale(0.96);
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    animation: placeholderPulse 0.6s ease-in-out;
}

@keyframes placeholderPulse {
    0% { transform: translate3d(0, 0, 0) scale(0.96); }
    50% { transform: translate3d(0, 0, 0) scale(0.98); }
    100% { transform: translate3d(0, 0, 0) scale(0.96); }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
}

#quiz-container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    text-align: center;
    position: relative;
}

/* Progress Indicator */
#progress-container {
    margin-bottom: 2rem;
    text-align: center;
}

#progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5cb85c, #4cae4c);
    border-radius: 20px;
    width: 6.25%; /* 1/16 for first question */
    transition: width 0.4s ease;
    box-shadow: 0 1px 3px rgba(92, 184, 92, 0.3);
}

#progress-text {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(92, 184, 92, 0.1);
    background: rgba(248, 255, 249, 0.3);
    border-radius: 0 0 15px 15px;
    margin-left: -2rem;
    margin-right: -2rem;
    margin-bottom: -2rem;
    animation: slideInLeft 0.5s ease-out 0.4s both;
}

/* Ensure navigation buttons have consistent width */
#prev-btn, #next-btn {
    min-width: 90px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Hint button styling */
#hint-btn {
    padding: 0.75rem;
    font-size: 1.1rem;
    border-radius: 50%;
    opacity: 0.9;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

#hint-btn:hover {
    opacity: 1;
    transform: translateY(-1px) scale(1.05);
    background-color: #5a6268;
    color: #ffd700;
}

#hint-btn i {
    transition: all 0.3s ease;
}

.btn-secondary {
    background-color: #6c757d;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

#question-header {
    margin-bottom: 2rem;
    animation: fadeInUp 0.5s ease-out;
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

#question-counter {
    font-size: 0.9rem;
    color: #666;
}

.answer-options {
    margin-bottom: 2rem;
    animation: scaleIn 0.6s ease-out 0.1s both;
}

.answer-option {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-radius: 15px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    cursor: grab;
    transition: transform 0.15s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.15s ease;
    user-select: none;
    justify-content: flex-start;
    min-height: 84px;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    gap: 1rem;
    direction: rtl;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(92, 184, 92, 0.1);
    animation: slideInRight 0.5s ease-out both;
}

/* Staggered animation delays for answer options */
.answer-option:nth-child(1) { animation-delay: 0.1s; }
.answer-option:nth-child(2) { animation-delay: 0.2s; }
.answer-option:nth-child(3) { animation-delay: 0.3s; }
.answer-option:nth-child(4) { animation-delay: 0.4s; }

.answer-option:hover {
    background: #f8fff9;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: rgba(92, 184, 92, 0.2);
}

.answer-option:hover .answer-rank {
    background: linear-gradient(135deg, #4cae4c, #449d44);
    box-shadow: 0 3px 12px rgba(92, 184, 92, 0.4);
    transform: scale(1.05);
}

.answer-option.dragging {
    opacity: 0.5;
    background: #e0e0e0;
}



.pop-up {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.pop-up-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fff9 100%);
    margin: auto;
    padding: 2rem;
    border: none;
    width: 90%;
    max-width: 520px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    text-align: right;
    position: relative;
    animation: popIn 0.4s ease-out;
    border: 2px solid rgba(92, 184, 92, 0.1);
}

.close-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    color: #666;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 117, 125, 0.1);
    transition: all 0.3s ease;
    border: none;
    z-index: 10;
}

.close-btn:hover,
.close-btn:focus {
    color: #5cb85c;
    background: rgba(92, 184, 92, 0.1);
    transform: scale(1.1);
}

#pop-up-text {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #2c3e50;
    margin: 0;
    padding-right: 1rem;
    font-weight: 400;
}

/* Popup animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

#finish-container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    text-align: center;
}

#answers-summary {
    text-align: left;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.answer-summary-item {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

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

.answer-summary-item h4 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.answer-summary-item ol {
    padding-left: 20px;
}

.answer-summary-item li {
    margin-bottom: 0.5rem;
    color: #555;
}

#welcome-container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    text-align: center;
}

#welcome-container h2 {
    margin-bottom: 1rem;
}

#welcome-container p {
    margin-bottom: 2rem;
    color: #666;
}

#name-input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 10px;
    font-size: 1rem;
}

/* Foundation Results Styling */
.foundation-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.foundation-stone-result {
    background: #fff;
    border-radius: 15px;
    border: 3px solid;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.foundation-stone-result:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.stone-header {
    padding: 1rem;
    color: white;
    text-align: center;
    font-weight: bold;
}

.stone-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.stone-content {
    padding: 2rem;
    text-align: center;
}

.score-circle {
    width: 120px;
    height: 120px;
    border: 4px solid;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    font-weight: 600;
}

.percentage {
    font-size: 2rem;
    font-weight: 700;
}

.score {
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.buttons-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* RTL styling for foundation results */
html[dir="rtl"] .foundation-results-grid {
    text-align: right;
}

html[dir="rtl"] .foundation-stone-result {
    text-align: right;
}

html[dir="rtl"] .stone-content {
    text-align: center;
}

/* Responsive design */
@media (max-width: 768px) {
    .foundation-results-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .percentage {
        font-size: 1.5rem;
    }
    
    .buttons-container {
        flex-direction: column;
        align-items: center;
    }
    
    .buttons-container .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .buttons {
        gap: 1rem;
        flex-wrap: wrap;
        padding: 1.25rem 0;
    }
    
    #prev-btn, #next-btn {
        min-width: 85px;
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .pop-up-content {
        width: 95%;
        padding: 1.5rem;
        border-radius: 15px;
        max-width: 400px;
    }
    
    #pop-up-text {
        font-size: 1rem;
        padding-right: 0.5rem;
    }
    
    /* Mobile survey improvements */
    .container {
        padding: 1rem;
        max-width: 100%;
    }
    
    #quiz-container {
        padding: 1.5rem;
        margin: 1rem auto;
    }
    
    .question h2 {
        font-size: 1.4rem;
        line-height: 1.4;
        margin-bottom: 1.5rem;
    }
    
    /* Mobile-friendly answer options */
    .answer-option {
        padding: 1rem;
        font-size: 1rem;
        margin-bottom: 0.75rem;
        min-height: 60px;
        touch-action: manipulation;
        cursor: pointer;
        border: 2px solid #e2e8f0;
        transition: all 0.2s ease;
    }
    
    .answer-option:active {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        border-color: #10b981;
    }
    
    .answer-rank {
        min-width: 32px;
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
        margin-left: 0.75rem;
    }
    
    .answer-text {
        font-size: 1rem;
        line-height: 1.4;
    }
    
    /* Gentle Microsoft Forms style mobile drag handle */
    .drag-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 48px;
        margin-right: 0.75rem;
        background: transparent;
        border: none;
        border-radius: 8px;
        cursor: grab;
        transition: background 0.15s ease, transform 0.1s ease;
        flex-shrink: 0;
        user-select: none;
        position: relative;
        will-change: transform;
        transform: translate3d(0, 0, 0);
    }
    
    .drag-handle:hover {
        background: rgba(0, 0, 0, 0.05);
    }
    
    .drag-handle.active,
    .drag-handle:active {
        cursor: grabbing;
        background: rgba(16, 185, 129, 0.1);
        transform: scale(0.95);
    }

    .drag-handle.active .handle-lines span,
    .drag-handle:active .handle-lines span {
        background: #10b981;
    }

    .handle-lines {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: center;
        z-index: 1;
        position: relative;
    }
    
    .handle-lines span {
        width: 18px;
        height: 2px;
        background: #cbd5e1;
        border-radius: 1px;
        transition: all 0.15s ease;
    }
    
    .drag-handle:hover .handle-lines span {
        background: #94a3b8;
        width: 20px;
    }
    
    html[dir="rtl"] #pop-up-text {
        padding-left: 0.5rem;
        padding-right: 0;
    }
}


