:root {
    --primary-color: #1a4f7a;
    --primary-dark: #0d3454;
    --secondary-color: #2d7bb8;
    --accent-color: #4CAF50;
    --text-color: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navigation */
.navbar {
    background: #e9ecef;
    padding: 0;
    box-shadow: var(--shadow);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.navbar-brand img {
    height: 45px;
    width: auto;
}

.navbar-brand span {
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
}

.navbar-nav .nav-link {
    color: #333 !important;
    padding: 1rem 1.2rem !important;
    font-weight: 500;
    transition: all 0.2s;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: #1a4f7a !important;
    background: rgba(0,0,0,0.05);
}

.navbar-toggler {
    border-color: rgba(0,0,0,0.3);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.6%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 60px 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}

/* Map Section */
.map-section {
    padding: 15px 0 40px 0;
    background: white;
}

.map-container {
    height: 550px;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.map-fullwidth {
    width: 100%;
    height: 70vh;
    min-height: 500px;
}

.map-fullwidth #map {
    height: 100%;
    width: 100%;
}

#map {
    height: 100%;
    width: 100%;
}

/* Description Section */
.description-section {
    background: white;
    border-top: 1px solid var(--border-color);
}

.description-section .lead {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.description-section h1 {
    color: var(--primary-dark);
    letter-spacing: 2px;
}

.scroll-indicator {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Stats Section */
.stats-section {
    padding: 50px 0;
    background: white;
}

.stat-card {
    text-align: center;
    padding: 30px 20px;
    border-radius: 10px;
    background: var(--bg-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.stat-card .number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .label {
    color: var(--text-light);
    font-size: 1rem;
    margin-top: 5px;
}

/* Station Cards */
.station-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}

.station-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.station-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.station-card .card-body {
    padding: 20px;
}

.station-card h5 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.station-card .location {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.station-card .status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.station-card .status.online,
.status.online {
    background: #28a745;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 500;
    display: inline-block;
}

.station-card .status.offline,
.status.offline {
    background: #dc3545;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 500;
    display: inline-block;
}

/* Station Detail */
.station-detail {
    padding: 40px 0;
}

.station-info {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.station-info h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.station-info .info-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
}

.station-info .info-row:last-child {
    border-bottom: none;
}

.station-info .info-label {
    flex: 0 0 150px;
    font-weight: 600;
    color: var(--text-light);
}

.station-info .info-value {
    flex: 1;
}

.detail-map {
    height: 300px;
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

.station-image {
    width: 100%;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 40px 0;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.page-header p {
    opacity: 0.9;
}

/* Content Sections */
.content-section {
    padding: 50px 0;
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.info-box {
    background: var(--bg-light);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 20px;
}

.info-box h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.info-box code {
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Tables */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table {
    margin-bottom: 0;
}

.data-table thead {
    background: var(--primary-color);
    color: white;
}

.data-table th {
    border: none;
    padding: 15px;
    font-weight: 500;
}

.data-table td {
    padding: 15px;
    vertical-align: middle;
}

/* Forms */
.form-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 25px;
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
}

.form-control, .form-select {
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 79, 122, 0.15);
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    padding: 12px 30px;
    font-weight: 500;
    border-radius: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    padding: 10px 25px;
    border-radius: 8px;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* Footer */
.footer {
    background: var(--primary-dark);
    color: white;
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer h5 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.footer a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: white;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Leaflet Popup */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
}

.leaflet-popup-content {
    margin: 15px;
}

.station-popup h5 {
    color: var(--primary-color);
    margin-bottom: 8px;
}

.station-popup p {
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.station-popup .btn {
    margin-top: 10px;
}

/* Responsive - Tablet */
@media (max-width: 992px) {
    .navbar-nav {
        padding: 15px 0;
    }

    .navbar-nav .nav-link {
        padding: 0.8rem 1rem !important;
    }

    .lang-dropdown {
        margin: 15px 0 0 0;
        width: 100%;
    }

    .lang-dropdown .dropdown-toggle {
        width: 100%;
        justify-content: center;
    }

    .description-section .lead {
        max-width: 100%;
        padding: 0 15px;
        font-size: 1rem;
    }

    .info-box {
        padding: 20px;
    }

    .station-detail .row {
        flex-direction: column;
    }

    .detail-map {
        height: 250px;
        margin-bottom: 20px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .map-container {
        height: 350px;
    }

    .stat-card .number {
        font-size: 2rem;
    }

    .station-info {
        padding: 20px;
    }

    .station-info .info-row {
        flex-direction: column;
    }

    .station-info .info-label {
        margin-bottom: 5px;
        flex: none;
    }

    .station-info .info-value {
        word-break: break-all;
        font-size: 0.9rem;
    }

    .description-section .lead {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .content-section {
        padding: 30px 0;
    }

    .form-section {
        padding: 20px;
    }

    .table-responsive {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .btn-primary,
    .btn-outline-primary {
        width: 100%;
        margin-bottom: 10px;
    }

    .page-header {
        padding: 25px 0;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .footer {
        padding: 30px 0 15px;
    }

    #station-gallery img {
        width: 100px !important;
        height: 75px !important;
    }

    /* NTRIP page fixes */
    pre {
        font-size: 0.75rem;
        overflow-x: auto;
    }

    .info-box code {
        word-break: break-all;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
    .navbar-brand img {
        height: 35px;
    }

    .map-container {
        height: 280px;
    }

    .description-section .lead {
        font-size: 0.9rem;
    }

    .station-info h1.display-4 {
        font-size: 2rem !important;
    }

    .info-box h4 {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .table-responsive {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 8px 5px;
    }

    .status.online,
    .status.offline {
        padding: 3px 8px;
        font-size: 0.75rem;
    }

    #station-gallery {
        justify-content: center;
    }

    #station-gallery img {
        width: 80px !important;
        height: 60px !important;
    }
}

/* Language Dropdown */
.lang-dropdown {
    margin-left: 20px;
}

.lang-dropdown .dropdown-toggle {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 6px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    font-size: 0.9rem;
}

.lang-dropdown .dropdown-toggle:hover,
.lang-dropdown .dropdown-toggle:focus {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.3);
}

.lang-dropdown .dropdown-toggle::after {
    margin-left: 4px;
}

.lang-flag {
    width: 24px;
    height: 16px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
}

.lang-dropdown .dropdown-menu {
    min-width: 160px;
    padding: 8px 0;
}

.lang-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
}

.lang-dropdown .dropdown-item:hover {
    background: var(--bg-light);
}

.lang-dropdown .dropdown-item.active {
    background: var(--primary-color);
    color: white;
}

/* RTL Support for Arabic */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.rtl .navbar-nav {
    flex-direction: row-reverse;
}

body.rtl .lang-switcher {
    margin-left: 0;
    margin-right: 20px;
}

body.rtl .info-row {
    flex-direction: row-reverse;
}

body.rtl .station-info .info-label {
    text-align: right;
}

body.rtl .form-check {
    padding-left: 0;
    padding-right: 1.5em;
}

body.rtl .form-check-input {
    float: right;
    margin-left: 0.5em;
    margin-right: -1.5em;
}

/* Utility Classes */
.section-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
}

.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background: var(--primary-color) !important;
}
