/* Main CSS - RTL & Arabic Fonts */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');

/* Info Grid & Tags */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item .label {
    font-size: 0.9rem;
    color: #7f8c8d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item .value {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
}

.tag {
    background: #f0f2f5;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #34495e;
    border: 1px solid #dfe6e9;
    font-family: 'Consolas', monospace;
    /* Monospace for technical data */
}

.status-tag {
    background: #e8f6f3;
    color: #1abc9c;
    border-color: #a3e4d7;
}

/* Base Styles */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --card-bg: #ffffff;
    --font-family: 'Tajawal', sans-serif;
    --spacing-unit: 1rem;
    --border-radius: 8px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    direction: rtl;
    text-align: right;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
    width: 100%;
}

main.container {
    flex: 1;
}

/* Header Styles */
header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 50px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--secondary-color);
}

/* Main Content Area */
.search-section {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.search-box {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

input[type="text"] {
    padding: 1rem;
    width: 60%;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 1.1rem;
}

button.btn-primary {
    padding: 1rem 2rem;
    border: none;
    background-color: var(--accent-color);
    color: white;
    font-family: var(--font-family);
    font-weight: bold;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}

button.btn-primary:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    padding: 1rem 2rem;
    border: none;
    background: none;
    font-family: var(--font-family);
    font-size: 1.1rem;
    cursor: pointer;
    color: #777;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
    /* Prevent text wrapping */
}

.tab-btn.active {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block !important;
}

/* Results Area */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 1rem;
    color: var(--secondary-color);
    border-right: 4px solid var(--secondary-color);
    padding-right: 0.5rem;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.data-label {
    font-weight: 500;
    color: #555;
}

.data-value {
    font-weight: 700;
    color: var(--primary-color);
}

.metric-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
    opacity: 0.9;
}

.metric-title {
    color: #555;
    /* Dark gray for title */
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 10px;
    letter-spacing: normal;
    text-transform: none;
    /* Reference image uses Normal case */
}

.metric-value-large {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
}

.metric-value-medium {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
    word-break: break-word;
}

/* Footer */
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem 0;
    margin-top: 4rem;
    text-align: center;
}

/* Loading Spinner */
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--secondary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
    display: none;
}

/* Sections Styling */
.section-content {
    padding: 4rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.section-content.alt-bg {
    background-color: rgba(0, 0, 0, 0.02);
    margin-left: -1000px;
    margin-right: -1000px;
    padding-left: 1000px;
    padding-right: 1000px;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: bold;
}

/* Metric Boxes Styling */
.metrics-grid {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping on very small screens */
    flex-direction: row;
    /* Force horizontal */
    justify-content: center;
    /* Center align when wrapping */
    gap: 1.5rem;
}

.metric-card {
    background: var(--card-bg);
    padding: 2.5rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    /* Softer shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1 1 250px;
    /* Allow growing, shrinking, basis 250px */
    min-width: 250px;
    /* Prevent shrinking too small */
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* About Content */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Contact Form */
.contact-form-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.contact-form {
    margin-top: 2rem;
    text-align: right;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design System - Comprehensive Coverage */

/* Global Fixes */
html,
body {
    overflow-x: hidden;
    /* Prevent horizontal scroll from full-width sections */
}

/* Data Value Overflow Protection */
.data-value {
    font-weight: 700;
    color: var(--primary-color);
    word-break: break-word;
    /* Critical for long URLs/Domains */
    overflow-wrap: break-word;
}

/* Extra Large Desktop (1920px+) */
@media screen and (min-width: 1920px) {
    .container {
        max-width: 1400px;
    }
}

/* Large Desktop (1440px - 1919px) */
@media screen and (max-width: 1919px) and (min-width: 1440px) {
    .container {
        max-width: 1300px;
    }
}

/* Standard Desktop (1200px - 1439px) */
@media screen and (max-width: 1439px) and (min-width: 1200px) {
    .container {
        max-width: 1140px;
        padding: 0 1.5rem;
    }

    .section-title {
        font-size: 1.9rem;
    }
}

/* Tablet & Smaller Laptops (1024px - 1199px) */
@media screen and (max-width: 1199px) and (min-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .search-section {
        padding: 3.5rem 0;
    }

    .metric-card {
        flex: 1 1 220px;
        min-width: 220px;
    }
}

/* Tablet Landscape (768px - 1023px) */
@media screen and (max-width: 1023px) and (min-width: 768px) {
    .container {
        padding: 0 1.5rem;
    }

    /* Header Stacking */
    .header-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .logo h1 {
        font-size: 1.6rem;
    }

    /* Search Section */
    .search-section {
        padding: 3rem 0;
    }

    .search-box {
        flex-direction: column;
        width: 100%;
    }

    input[type="text"] {
        width: 100%;
        margin-bottom: 1rem;
    }

    button.btn-primary {
        width: 100%;
    }

    /* Tabs scrollable */
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex: 0 0 auto;
        padding: 0.8rem 1.2rem;
    }

    /* Typography Scaling */
    .section-title {
        font-size: 1.7rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .metric-card {
        flex: 1 1 200px;
        min-width: 200px;
    }

    .results-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Tablet Portrait (600px - 767px) */
@media screen and (max-width: 767px) and (min-width: 600px) {
    .container {
        padding: 0 1.2rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1.2rem;
        text-align: center;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem;
        font-size: 0.95rem;
    }

    .search-section {
        padding: 2.5rem 0;
    }

    .search-box {
        flex-direction: column;
        width: 100%;
    }

    input[type="text"] {
        width: 100%;
        margin-bottom: 1rem;
        font-size: 1rem;
    }

    button.btn-primary {
        width: 100%;
        padding: 0.9rem 1.5rem;
    }

    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        flex: 0 0 auto;
        padding: 0.75rem 1.1rem;
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.15rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Mobile Large (480px - 599px) */
@media screen and (max-width: 599px) and (min-width: 480px) {
    :root {
        --spacing-unit: 0.9rem;
    }

    .container {
        padding: 0 1rem;
    }

    /* Compact Header */
    .logo img {
        height: 45px;
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    /* Navigation Stack */
    nav ul {
        gap: 0.7rem;
        font-size: 0.9rem;
    }

    .search-section {
        padding: 2rem 0;
    }

    input[type="text"] {
        padding: 0.9rem;
        font-size: 0.95rem;
    }

    button.btn-primary {
        padding: 0.9rem 1.5rem;
        font-size: 0.95rem;
    }

    .tab-btn {
        padding: 0.7rem 1rem;
        font-size: 0.95rem;
    }

    /* Cards */
    .card {
        padding: 1.2rem;
    }

    .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }

    .data-label {
        font-size: 0.9rem;
        color: #777;
    }

    .data-value {
        font-size: 1.05rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    /* Full Width Sections correction */
    .section-content.alt-bg {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Mobile Small (320px - 479px) */
@media screen and (max-width: 479px) {
    :root {
        --spacing-unit: 0.8rem;
    }

    .container {
        padding: 0 0.8rem;
    }

    /* Compact Header */
    .logo img {
        height: 40px;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    /* Navigation Stack */
    nav ul {
        gap: 0.6rem;
        font-size: 0.85rem;
    }

    .search-section {
        padding: 1.8rem 0;
    }

    input[type="text"] {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    button.btn-primary {
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }

    .tab-btn {
        padding: 0.65rem 0.9rem;
        font-size: 0.9rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
    }

    .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .data-label {
        font-size: 0.85rem;
        color: #777;
    }

    .data-value {
        font-size: 1rem;
    }

    .section-title {
        font-size: 1.4rem;
        margin-bottom: 2rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    h3 {
        font-size: 1rem;
    }

    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .feature-card i {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    /* Full Width Sections correction */
    .section-content.alt-bg {
        margin-left: -0.8rem;
        margin-right: -0.8rem;
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    footer {
        padding: 2rem 0;
        margin-top: 3rem;
    }
}

/* Responsive for Horizontal Info Grid (5 columns) */
@media screen and (max-width: 1200px) {
    .info-grid[style*="repeat(5"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media screen and (max-width: 768px) {
    .info-grid[style*="repeat(5"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media screen and (max-width: 480px) {
    .info-grid[style*="repeat(5"] {
        grid-template-columns: 1fr !important;
    }
}