/**
 * Instructions Screen
 * Clean, professional instruction modal with modern aesthetic
 */

/* Typography System */
@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@400;600;700&family=Imperial:wght@400;600&display=swap');

/* Instruction Modal Overlay */
.instruction-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
    /* Defensive CSS to prevent inheritance issues */
    margin: 0 !important;
    border: none !important;
    outline: none !important;
    transform: none !important;
    /* Ensure it's not affected by parent flex containers */
    flex: none !important;
    align-self: auto !important;
    justify-self: auto !important;
    /* Reset any potential parent styling */
    float: none !important;
    clear: both !important;
}

.instruction-overlay.show {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Main Instruction Modal */
.instruction-modal {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    position: relative;
}

.instruction-overlay.show .instruction-modal {
    transform: translateY(0);
}

/* Header */
.instruction-header {
    padding: 24px 24px 16px 24px;
    border-bottom: 1px solid #d3d6da;
    text-align: center;
}

.instruction-title {
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #000000;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
}

.instruction-subtitle {
    font-family: 'Imperial', Georgia, 'Times New Roman', serif;
    font-size: 16px;
    color: #565656;
    margin: 0;
    font-weight: 400;
}

/* Content */
.instruction-content {
    padding: 24px;
}

.instruction-section {
    margin-bottom: 24px;
}

.instruction-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #000000;
    margin: 0 0 12px 0;
    letter-spacing: -0.3px;
}

.section-text {
    font-family: 'Imperial', Georgia, 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.5;
    color: #000000;
    margin: 0 0 16px 0;
}

/* Word Reading Directions */
.reading-directions {
    background: #f6f7f8;
    border: 1px solid #d3d6da;
    border-radius: 6px;
    padding: 16px;
    margin: 16px 0;
}

.direction-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #000000;
}

.direction-item:last-child {
    margin-bottom: 0;
}

.direction-arrow {
    font-size: 16px;
    margin-right: 8px;
    width: 20px;
    text-align: center;
}

.direction-label {
    font-weight: 600;
    margin-right: 8px;
    min-width: 60px;
}

.direction-description {
    color: #565656;
}

/* Visual Diagram */
.instruction-diagram {
    background: #ffffff;
    border: 2px solid #d3d6da;
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
    text-align: center;
}

.diagram-circles {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 16px auto;
}

.diagram-circle {
    position: absolute;
    border: 2px solid #000000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: #000000;
}

.diagram-outer {
    width: 120px;
    height: 120px;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.02);
}

.diagram-middle {
    width: 90px;
    height: 90px;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.04);
}

.diagram-inner {
    width: 60px;
    height: 60px;
    top: 30px;
    left: 30px;
    background: rgba(0, 0, 0, 0.06);
}

.diagram-center {
    width: 30px;
    height: 30px;
    top: 45px;
    left: 45px;
    background: #f7da21;
    border-color: #000000;
}

.diagram-labels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    color: #565656;
}

/* Controls Section */
.controls-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.controls-list li {
    font-family: 'Imperial', Georgia, 'Times New Roman', serif;
    font-size: 16px;
    line-height: 1.5;
    color: #000000;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.controls-list li:before {
    content: "•";
    color: #f7da21;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Action Buttons */
.instruction-actions {
    padding: 16px 24px 24px 24px;
    border-top: 1px solid #d3d6da;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.instruction-button {
    font-family: 'Libre Franklin', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 600;
    padding: 12px 24px;
    border: 2px solid #000000;
    border-radius: 6px;
    background: #ffffff;
    color: #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-width: 120px;
}

.instruction-button:hover {
    background: #000000;
    color: #ffffff;
}

.instruction-button:active {
    transform: translateY(1px);
}

.instruction-button.primary {
    background: #000000;
    color: #ffffff;
}

.instruction-button.primary:hover {
    background: #333333;
}

/* Close Button */
.instruction-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.instruction-close:hover {
    background: #f6f7f8;
}

.instruction-close:before {
    content: "×";
    font-size: 24px;
    color: #565656;
    line-height: 1;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .instruction-overlay {
        padding: 10px;
    }
    
    .instruction-modal {
        max-height: 95vh;
    }
    
    .instruction-header {
        padding: 20px 20px 16px 20px;
    }
    
    .instruction-title {
        font-size: 20px;
    }
    
    .instruction-subtitle {
        font-size: 14px;
    }
    
    .instruction-content {
        padding: 20px;
    }
    
    .section-title {
        font-size: 16px;
    }
    
    .section-text {
        font-size: 15px;
    }
    
    .reading-directions {
        padding: 12px;
    }
    
    .direction-item {
        font-size: 13px;
    }
    
    .diagram-circles {
        width: 100px;
        height: 100px;
    }
    
    .diagram-outer {
        width: 100px;
        height: 100px;
    }
    
    .diagram-middle {
        width: 75px;
        height: 75px;
        top: 12.5px;
        left: 12.5px;
    }
    
    .diagram-inner {
        width: 50px;
        height: 50px;
        top: 25px;
        left: 25px;
    }
    
    .diagram-center {
        width: 25px;
        height: 25px;
        top: 37.5px;
        left: 37.5px;
    }
    
    .instruction-actions {
        padding: 16px 20px 20px 20px;
        flex-direction: column;
        align-items: center;
    }
    
    .instruction-button {
        font-size: 15px;
        padding: 14px 20px;
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
}

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

.instruction-modal.animate-in {
    animation: fadeInUp 0.4s ease-out;
}

/* Highlight effect for important text */
.highlight {
    background: linear-gradient(180deg, transparent 60%, #f7da21 60%);
    padding: 0 2px;
}

/* Success state styling */
.success-text {
    color: #6aaa64;
    font-weight: 600;
}
