* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.intro h2 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 2em;
}

.intro p {
    margin-bottom: 20px;
    font-size: 1.1em;
    color: #666;
}

.instructions {
    background: #f7fafc;
    padding: 25px;
    border-radius: 10px;
    margin: 30px 0;
    border-right: 4px solid #667eea;
}

.instructions h3 {
    color: #4a5568;
    margin-bottom: 15px;
}

.instructions ul {
    margin-right: 20px;
}

.instructions li {
    margin-bottom: 10px;
    color: #666;
}

.warning {
    background: #fed7d7;
    border: 1px solid #fc8181;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
}

.warning p {
    color: #c53030;
    font-weight: 500;
    margin: 0;
}

.start-btn {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 40px;
    text-decoration: none;
    border-radius: 50px;
    font-size: 1.2em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

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

/* Test Page Styles */
.test-container {
    text-align: center;
}

.test-header {
    margin-bottom: 30px;
}

.selection-info {
    background: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.colors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 40px 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.color-card {
    width: 120px;
    height: 120px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.color-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.color-card.selected {
    border-color: #fff;
    box-shadow: 0 0 20px rgba(255,255,255,0.8);
    transform: translateY(-5px);
}

.color-card .color-number {
    display: none;
}

.selected-order {
    margin: 30px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
}

.selected-colors {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.selected-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.control-buttons {
    margin: 30px 0;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

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

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

/* Results Page Styles */
.results-container {
    max-width: 900px;
    margin: 0 auto;
}

.test-summary {
    background: #f7fafc;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    border-right: 4px solid #667eea;
}

.color-sequences {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.sequence {
    text-align: center;
}

.sequence h4 {
    margin-bottom: 15px;
    color: #4a5568;
}

.interpretation-section {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.interpretation-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.function-group {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
}

.function-plus { background: #d4edda; border-right: 4px solid #28a745; }
.function-x { background: #d1ecf1; border-right: 4px solid #17a2b8; }
.function-equals { background: #fff3cd; border-right: 4px solid #ffc107; }
.function-minus { background: #f8d7da; border-right: 4px solid #dc3545; }

.color-meaning {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

footer {
    text-align: center;
    color: white;
    opacity: 0.8;
}

/* Arabic RTL Support */
[dir="rtl"] .selected-colors {
    flex-direction: row-reverse;
}

[dir="rtl"] .color-sequences {
    text-align: right;
}

[dir="rtl"] .control-buttons {
    text-align: center;
}

[dir="rtl"] ul {
    text-align: right;
}

[dir="rtl"] .color-meaning div[style*="display: flex"] {
    flex-direction: row-reverse;
}

/* Fix margin directions for RTL */
[dir="rtl"] .color-meaning div[style*="margin-right"] {
    margin-right: 0 !important;
    margin-left: 15px !important;
}

[dir="rtl"] .selected-color {
    margin: 0 2px;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    main {
        padding: 20px;
    }
    
    .colors-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .color-card {
        width: 100px;
        height: 100px;
    }
    
    .color-sequences {
        grid-template-columns: 1fr;
    }
    
    .control-buttons {
        flex-direction: column;
        align-items: center;
    }
}

/* Social Media Sharing Styles */
.social-sharing {
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    text-decoration: none;
    color: white;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.social-btn.whatsapp {
    background: #25D366;
}

.social-btn.whatsapp:hover {
    background: #20BA5A;
}

.social-btn.twitter {
    background: #1DA1F2;
}

.social-btn.twitter:hover {
    background: #0d8bd9;
}

.social-btn.facebook {
    background: #4267B2;
}

.social-btn.facebook:hover {
    background: #365899;
}

.social-btn.telegram {
    background: #0088cc;
}

.social-btn.telegram:hover {
    background: #0077b5;
}

.social-btn.linkedin {
    background: #0077B5;
}

.social-btn.linkedin:hover {
    background: #005885;
}

.social-btn.copy-link {
    background: #6c757d;
}

.social-btn.copy-link:hover {
    background: #545b62;
}

/* Responsive adjustments for social buttons */
@media (max-width: 768px) {
    .social-sharing {
        margin: 20px -20px;
        padding: 20px;
        border-radius: 0;
    }
    
    .social-btn {
        width: 45px;
        height: 45px;
    }
    
    .social-icons {
        gap: 12px;
    }
}