/* Celcom Brand Colors */
:root {
    --celcom-blue: #000b76;
    --celcom-green: #198754;
    --celcom-secondary: #49316c;
    --covered-color: #000b76;
    --covered-hover: #0015a8;
    --uncovered-color: #e9ecef;
    --uncovered-border: #ced4da;
    --text-primary: #252930;
    --text-secondary: #6c757d;
    --bg-light: #f8f9fa;
}

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

body {
    font-family: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.map-container {
    width: 100%;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
}

.map-header {
    background: linear-gradient(135deg, var(--celcom-blue) 0%, var(--celcom-secondary) 100%);
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.map-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.map-header p {
    font-size: 0.95rem;
    opacity: 0.9;
}

#map {
    flex: 1;
    width: 100%;
    z-index: 1;
}

/* Custom Popup Card Styling */
.coverage-popup {
    position: fixed !important;
    background: white;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    padding: 0;
    min-width: 280px;
    min-height: 180px;
    max-width: 450px;
    max-height: 70vh;
    width: 320px;
    z-index: 10000 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    pointer-events: none;
    resize: both;
    overflow: auto;
    border: 2px solid var(--celcom-blue);
}

.coverage-popup.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Resize handle styling */
.coverage-popup::-webkit-resizer {
    background: var(--celcom-blue);
    border-radius: 0 0 12px 0;
    width: 20px;
    height: 20px;
}

/* Visual resize indicator */
.coverage-popup::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: linear-gradient(-45deg, transparent 30%, var(--celcom-blue) 30%, var(--celcom-blue) 40%, transparent 40%, transparent 60%, var(--celcom-blue) 60%, var(--celcom-blue) 70%, transparent 70%);
    cursor: nwse-resize;
    pointer-events: none;
    z-index: 10001;
    opacity: 0.6;
}

.coverage-popup:hover::after {
    opacity: 1;
}

.popup-content {
    padding: 1rem 1.25rem;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    position: relative;
}

/* Close button */
.popup-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #666;
    z-index: 10002;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.popup-close:hover {
    background: var(--celcom-blue);
    color: #fff;
    transform: rotate(90deg);
}

.popup-close::before {
    content: '×';
    font-size: 1.5rem;
    font-weight: 300;
}

/* Ensure popup content is scrollable if needed */
.popup-content::-webkit-scrollbar {
    width: 8px;
}

.popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb {
    background: var(--celcom-blue);
    border-radius: 4px;
}

.popup-content::-webkit-scrollbar-thumb:hover {
    background: var(--covered-hover);
}

.popup-content h2 {
    color: var(--celcom-blue);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    margin-right: 2rem;
    border-bottom: 2px solid var(--celcom-blue);
    padding-bottom: 0.4rem;
    line-height: 1.3;
}

.coverage-summary {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.6rem;
    background: var(--bg-light);
    border-left: 3px solid var(--celcom-green);
    border-radius: 4px;
}

.popup-section {
    margin-bottom: 0.875rem;
}

.popup-section:last-child {
    margin-bottom: 0;
}

.popup-section h3 {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.popup-section h3::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--celcom-blue);
    border-radius: 2px;
}

.networks-list,
.rates-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.networks-list li,
.rates-list li {
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.35rem;
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.networks-list li::before {
    content: '✓';
    color: var(--celcom-green);
    font-weight: bold;
    font-size: 0.85rem;
}

.rates-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rates-list li .rate-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.rates-list li .rate-value {
    font-weight: 600;
    color: var(--celcom-blue);
    font-size: 0.8rem;
}

.rates-list li .rate-value a {
    color: var(--celcom-blue);
    text-decoration: underline;
    font-weight: 600;
}

.rates-list li .rate-value a:hover,
.rates-list li .rate-value a:focus {
    color: var(--celcom-blue);
    text-decoration: none;
}

/* Leaflet Overrides */
.leaflet-container {
    background: #f5f5f5;
    font-family: inherit;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Country Tooltip Styling */
.country-tooltip {
    background: rgba(0, 11, 118, 0.9) !important;
    border: 1px solid var(--celcom-blue) !important;
    border-radius: 6px !important;
    color: white !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    padding: 6px 10px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    white-space: nowrap !important;
}

.country-tooltip::before {
    border-top-color: rgba(0, 11, 118, 0.9) !important;
}

/* Country Layer Styles */
.country-covered {
    fill: var(--covered-color);
    fill-opacity: 0.7;
    stroke: var(--covered-color);
    stroke-width: 1.5;
    stroke-opacity: 0.9;
    transition: all 0.3s ease;
}

.country-covered:hover {
    fill: var(--covered-hover);
    fill-opacity: 0.85;
    stroke-width: 2;
    cursor: pointer;
}

.country-uncovered {
    fill: var(--uncovered-color);
    fill-opacity: 0.6;
    stroke: var(--uncovered-border);
    stroke-width: 1;
    stroke-opacity: 0.7;
}

.country-uncovered:hover {
    fill-opacity: 0.7;
    cursor: default;
}

/* Responsive Design */
@media (max-width: 768px) {
    .map-header {
        padding: 1rem 1.5rem;
    }
    
    .map-header h1 {
        font-size: 1.5rem;
    }
    
    .coverage-popup {
        min-width: 280px;
        max-width: 90%;
    }
    
    .popup-content {
        padding: 1.25rem;
    }
    
    .popup-content h2 {
        font-size: 1.25rem;
    }
}
