/*
 * 5G Dimensioning Tool Stylesheet
 * Mobile-First, Arabic/English Support
 */

/* -------------------------------------------------------------------------- */
/* 1. Base Styles and Typography */
/* -------------------------------------------------------------------------- */

:root {
    --primary-color: #007bff; /* Blue */
    --secondary-color: #6c757d; /* Gray */
    --success-color: #28a745; /* Green */
    --background-color: #f8f9fa; /* Light Gray */
    --card-background: #ffffff; /* White */
    --text-color: #343a40; /* Dark Gray */
    --border-color: #dee2e6; /* Light Border */
    --shadow-color: rgba(0, 0, 0, 0.1);
    --font-ar: 'Cairo', sans-serif;
    --font-en: 'Roboto', sans-serif;
}

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

body {
    font-family: var(--font-ar), var(--font-en);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    direction: rtl; /* Default to Arabic direction */
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

/* Ensure English text uses LTR direction and English font */
.en {
    font-family: var(--font-en);
    direction: ltr;
    display: inline-block; /* To contain the ltr effect */
}

h1, h2 {
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary-color);
}

h1 {
    font-size: 1.8rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
}

h2 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 10px;
}

/* -------------------------------------------------------------------------- */
/* 2. Card and Layout */
/* -------------------------------------------------------------------------- */

.card {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-color);
    margin-bottom: 25px;
    border-right: 5px solid var(--primary-color); /* Highlight for RTL */
}

header {
    text-align: center;
    margin-bottom: 30px;
}

/* -------------------------------------------------------------------------- */
/* 3. Form Styling */
/* -------------------------------------------------------------------------- */

fieldset {
    border: 1px solid var(--border-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
}

legend {
    font-weight: 700;
    color: var(--primary-color);
    padding: 0 10px;
    font-size: 1.1rem;
}

.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
    font-size: 0.95rem;
}

input[type="number"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-en), var(--font-ar); /* Ensure numbers look right */
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="number"]:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.hint {
    font-size: 0.8rem;
    color: var(--secondary-color);
    margin-top: 5px;
}

/* -------------------------------------------------------------------------- */
/* 4. Buttons */
/* -------------------------------------------------------------------------- */

#calculate-button {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    margin-top: 10px;
}

#calculate-button:hover {
    background-color: #0056b3;
}

#calculate-button:active {
    transform: scale(0.99);
}

/* -------------------------------------------------------------------------- */
/* 5. Results Section */
/* -------------------------------------------------------------------------- */

.hidden {
    display: none;
}

#results-output {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.result-box {
    background-color: var(--background-color);
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.result-box h3 {
    font-size: 1rem;
    color: var(--secondary-color);
    margin-bottom: 5px;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success-color);
    font-family: var(--font-en);
}

.result-unit {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
    text-align: center;
}

/* Highlight the final result (N Sites) */
.highlight-result {
    border: 2px solid var(--primary-color);
    background-color: #e9f7ff;
}

/* -------------------------------------------------------------------------- */
/* 6. Reference Tables Styling */
/* -------------------------------------------------------------------------- */

.reference-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9rem;
    text-align: right;
}

.reference-table th, .reference-table td {
    border: 1px solid var(--border-color);
    padding: 10px;
}

.reference-table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
    text-align: center;
}

.reference-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

/* -------------------------------------------------------------------------- */
/* 7. Footer */
/* -------------------------------------------------------------------------- */

footer {
    text-align: center;
    padding: 15px 0;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--secondary-color);
    border-top: 1px solid var(--border-color);
}

/* -------------------------------------------------------------------------- */
/* 8. Media Queries for Desktop (LTR adjustments) */
/* -------------------------------------------------------------------------- */

@media (min-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .card {
        padding: 30px;
    }

    /* Arrange form groups in two columns for wider screens */
    fieldset {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Override for legend and button to span full width */
    legend, #calculate-button {
        grid-column: 1 / -1;
    }
    
    /* LTR adjustments for English interface (if needed, but we keep it RTL for Arabic) */
    /* If the user switches to LTR, we'd add a class to body and override direction/border */
    /* For now, we keep the RTL flow as the default */
}
