/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--surface);
}

html[lang="ar"] body {
    direction: rtl;
    text-align: right;
}

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

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 8s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    animation: slideDown 0.6s ease-out;
}

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

header .subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    animation: slideDown 0.6s ease-out 0.1s backwards;
}

/* Language Selector */
.language-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.language-selector label {
    display: flex;
    align-items: center;
}

.language-selector svg {
    width: 20px;
    height: 20px;
}

.language-selector select {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.language-selector select:hover,
.language-selector select:focus {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    outline: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.language-selector select option {
    background: var(--background);
    color: var(--text-primary);
}

/* Navigation Tabs */
.nav-tabs {
    background: var(--background);
    border-bottom: 2px solid var(--border);
    box-shadow: 0 2px 4px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-tabs .container {
    display: flex;
    gap: 0;
    overflow-x: auto;
    padding: 0;
}

.tab-button {
    flex: 1;
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    position: relative;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-button::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), #7c3aed);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.tab-button:hover {
    background: var(--surface);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tab-button:hover::before {
    width: 80%;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: transparent;
    background: var(--surface);
    font-weight: 600;
}

.tab-button.active::before {
    width: 100%;
}

/* Main Content */
main {
    min-height: 60vh;
    padding: 3rem 20px;
}

#content-area {
    background: var(--background);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.5s ease-out;
    border: 1px solid var(--border);
}

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

#content-area h1 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary-color);
}

#content-area h2 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

#content-area h3 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

#content-area p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

#content-area ul,
#content-area ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

html[lang="ar"] #content-area ul,
html[lang="ar"] #content-area ol {
    margin-left: 0;
    margin-right: 2rem;
}

#content-area li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

#content-area a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

#content-area a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

#content-area strong,
#content-area b {
    color: var(--text-primary);
    font-weight: 600;
}

#content-area hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 2rem 0;
}

/* Important/Warning Boxes */
#content-area p:has(strong:first-child) {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
    padding: 1rem;
    border-radius: 8px;
    margin: 1.5rem 0;
}

html[lang="ar"] #content-area p:has(strong:first-child) {
    border-left: none;
    border-right: 4px solid var(--warning);
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 3rem;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Smooth Transitions for Content */
#content-area h1,
#content-area h2,
#content-area h3 {
    animation: slideInLeft 0.5s ease-out;
}

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

#content-area p,
#content-area ul,
#content-area ol {
    animation: fadeIn 0.6s ease-out;
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

footer p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

footer .update-date {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    header .subtitle {
        font-size: 1rem;
    }

    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    #content-area {
        padding: 1.5rem;
    }

    #content-area h1 {
        font-size: 1.8rem;
    }

    #content-area h2 {
        font-size: 1.5rem;
    }

    #content-area h3 {
        font-size: 1.2rem;
    }

    #content-area ul,
    #content-area ol {
        margin-left: 1.5rem;
    }

    html[lang="ar"] #content-area ul,
    html[lang="ar"] #content-area ol {
        margin-left: 0;
        margin-right: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    header {
        padding: 1.5rem 0;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .tab-button {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    #content-area {
        padding: 1rem;
    }

    main {
        padding: 2rem 15px;
    }
}

/* Print Styles */
@media print {
    header,
    .nav-tabs,
    footer,
    .language-selector {
        display: none;
    }

    #content-area {
        box-shadow: none;
        padding: 0;
    }

    body {
        background: white;
    }
}

/* Accessibility */
.tab-button:focus,
.language-selector select:focus {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Text Selection */
::selection {
    background: var(--primary-color);
    color: white;
}
