/* ============================================
   تحدي المهندسين - Engineers Challenge Plugin
   CSS Styles
   ============================================ */

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #0f172a;
    --light-bg: #f8fafc;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.15);
}

/* ============================================
   Global Styles
   ============================================ */

.ec-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
    color: var(--text-dark);
}

.ec-container * {
    box-sizing: border-box;
}

/* ============================================
   Welcome Screen
   ============================================ */

.ec-welcome-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.6s ease-out;
}

.ec-header {
    margin-bottom: 40px;
}

.ec-title {
    font-size: 48px;
    font-weight: 700;
    margin: 0 0 15px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.ec-subtitle {
    font-size: 18px;
    margin: 0;
    opacity: 0.95;
    font-weight: 300;
}

/* ============================================
   Statistics Preview
   ============================================ */

.ec-stats-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.ec-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.ec-stat-number {
    font-size: 36px;
    font-weight: 700;
    display: block;
}

.ec-stat-label {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 500;
}

/* ============================================
   Phone Input Section
   ============================================ */

.ec-phone-input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.ec-phone-input {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-dark);
    font-size: 16px;
    transition: all 0.3s ease;
}

.ec-phone-input:focus {
    outline: none;
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.ec-phone-input::placeholder {
    color: var(--text-light);
}

/* ============================================
   Buttons
   ============================================ */

.ec-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.ec-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.ec-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

.ec-btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.ec-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

/* ============================================
   Info Text
   ============================================ */

.ec-info-text {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.8;
}

.ec-info-text p {
    margin: 8px 0;
}

/* ============================================
   Game Screen
   ============================================ */

.ec-game-screen {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.ec-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.ec-timer {
    font-size: 28px;
    font-weight: 700;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ec-progress {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

/* ============================================
   Question Container
   ============================================ */

.ec-question-container {
    margin-bottom: 40px;
    animation: fadeIn 0.4s ease-out;
}

.ec-question-text {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 30px 0;
    line-height: 1.6;
    color: var(--text-dark);
}

.ec-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.ec-option-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: right;
    font-size: 16px;
}

.ec-option-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
    transform: translateX(-5px);
}

.ec-option-btn.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.ec-option-btn.correct {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.ec-option-btn.incorrect {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.ec-option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    flex-shrink: 0;
}

.ec-option-text {
    flex: 1;
}

/* ============================================
   Feedback
   ============================================ */

.ec-feedback {
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    animation: slideInUp 0.3s ease-out;
}

.ec-feedback.correct {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.ec-feedback.incorrect {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

/* ============================================
   Registration Screen
   ============================================ */

.ec-registration-screen {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.ec-registration-screen h2 {
    font-size: 28px;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.ec-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ec-form-input {
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.ec-form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ============================================
   Result Screen
   ============================================ */

.ec-result-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.ec-result-header {
    margin-bottom: 30px;
}

.ec-result-title {
    font-size: 32px;
    margin-bottom: 20px;
}

.ec-result-score {
    font-size: 64px;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 10px;
}

.ec-score-label {
    font-size: 32px;
}

.ec-result-message {
    font-size: 20px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    line-height: 1.6;
}

.ec-result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.ec-detail-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ec-detail-label {
    font-size: 14px;
    opacity: 0.9;
}

.ec-detail-value {
    font-size: 20px;
    font-weight: 600;
}

.ec-result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

/* ============================================
   Ranking Table
   ============================================ */

.ec-ranking-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.ec-ranking-title {
    font-size: 28px;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.ec-ranking-table {
    width: 100%;
    border-collapse: collapse;
}

.ec-ranking-table thead {
    background: var(--light-bg);
}

.ec-ranking-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
}

.ec-ranking-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.ec-ranking-table tbody tr:hover {
    background: var(--light-bg);
}

.ec-level-badge {
    display: inline-block;
    padding: 5px 12px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* ============================================
   Statistics Container
   ============================================ */

.ec-statistics-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.ec-statistics-title {
    font-size: 28px;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.ec-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.ec-stat-card {
    padding: 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--shadow);
}

.ec-stat-card h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    opacity: 0.9;
}

.ec-stat-value {
    font-size: 36px;
    font-weight: 700;
    margin: 0;
}

.ec-universities-ranking {
    margin-top: 40px;
}

.ec-universities-ranking h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.ec-universities-table {
    width: 100%;
    border-collapse: collapse;
}

.ec-universities-table thead {
    background: var(--light-bg);
}

.ec-universities-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
}

.ec-universities-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* ============================================
   Animations
   ============================================ */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    .ec-welcome-screen {
        padding: 40px 20px;
    }
    
    .ec-title {
        font-size: 36px;
    }
    
    .ec-subtitle {
        font-size: 16px;
    }
    
    .ec-stats-preview {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 20px;
    }
    
    .ec-stat-number {
        font-size: 24px;
    }
    
    .ec-stat-label {
        font-size: 12px;
    }
    
    .ec-phone-input-section {
        flex-direction: column;
    }
    
    .ec-phone-input {
        min-width: auto;
    }
    
    .ec-game-screen,
    .ec-registration-screen,
    .ec-result-screen {
        padding: 20px;
    }
    
    .ec-question-text {
        font-size: 18px;
    }
    
    .ec-option-btn {
        padding: 15px;
    }
    
    .ec-result-score {
        font-size: 48px;
    }
    
    .ec-result-message {
        font-size: 16px;
    }
    
    .ec-result-actions {
        flex-direction: column;
    }
    
    .ec-btn {
        width: 100%;
    }
    
    .ec-ranking-table,
    .ec-universities-table {
        font-size: 14px;
    }
    
    .ec-ranking-table th,
    .ec-ranking-table td,
    .ec-universities-table th,
    .ec-universities-table td {
        padding: 10px;
    }
    
    .ec-stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .ec-title {
        font-size: 28px;
    }
    
    .ec-stats-preview {
        grid-template-columns: 1fr;
    }
    
    .ec-game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .ec-result-details {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .ec-btn,
    .ec-phone-input-section {
        display: none;
    }
}
