/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

header i {
    margin-right: 10px;
    color: #ffd700;
}

/* Statistics Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    transition: all 0.3s ease;
}

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

.stat-card i {
    font-size: 2.5rem;
    color: #667eea;
    margin-bottom: 15px;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.search-container i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 1.2rem;
}

#search-input {
    width: 100%;
    padding: 15px 20px 15px 55px;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
}

.language-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 5px;
}

.lang-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 15px;
    background: #f0f0f0;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.lang-btn.active {
    background: #667eea;
    color: white;
}

.lang-btn:hover:not(.active) {
    background: #e0e0e0;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    margin-bottom: 40px;
}

.provinces-section {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.provinces-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.provinces-section h2 i {
    margin-right: 10px;
    color: #667eea;
}

.provinces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
}

.provinces-grid::-webkit-scrollbar {
    width: 6px;
}

.provinces-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.provinces-grid::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.province-card {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.province-card:hover {
    background: #e8ecff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.province-card.selected {
    border-color: #667eea;
    background: #e8ecff;
}

.province-code {
    position: absolute;
    top: 10px;
    right: 15px;
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: bold;
}

.province-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    padding-right: 50px;
}

.province-alt-name {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.province-stats {
    color: #888;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.province-stats i {
    color: #667eea;
}

/* Details Section */
.details-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.details-card {
    background: white;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.details-card h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.details-card h3 i {
    color: #667eea;
}

.placeholder-text {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

.province-info .info-row {
    margin-bottom: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.province-info .info-row strong {
    color: #667eea;
    margin-right: 10px;
}

/* Districts List */
#districts-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

#districts-list::-webkit-scrollbar {
    width: 6px;
}

#districts-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#districts-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.district-item {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.district-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.district-alt-name {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.district-code {
    color: #888;
    font-size: 0.8rem;
}

.district-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.district-item:hover {
    background: #e8ecff;
    transform: translateX(5px);
}

.district-item.selected {
    background: #e8ecff;
    border-left-color: #4caf50;
}

/* Sub-districts Styling */
.sub-district-header {
    margin-bottom: 15px;
    text-align: center;
}

.sub-district-info {
    color: #666;
    font-style: italic;
    margin: 0;
}

#sub-districts-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

#sub-districts-list::-webkit-scrollbar {
    width: 6px;
}

#sub-districts-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#sub-districts-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.sub-district-item {
    background: #f0f8f0;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid #4caf50;
    transition: all 0.3s ease;
}

.sub-district-item:hover {
    background: #e8f5e8;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.sub-district-name {
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 3px;
}

.sub-district-alt-name {
    color: #4caf50;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.sub-district-code {
    color: #666;
    font-size: 0.8rem;
}

.sub-district-count {
    text-align: center;
    padding: 15px;
    background: #f0f8f0;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid #e0f2e0;
}

.sub-district-count .count-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2e7d32;
    margin-bottom: 5px;
}

.sub-district-count .count-label {
    color: #4caf50;
    font-size: 0.9rem;
}

/* Featured Section */
.featured-section {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.featured-section h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8rem;
    text-align: center;
}

.featured-section h2 i {
    margin-right: 10px;
    color: #ffd700;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.featured-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.featured-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.featured-card.selected {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.featured-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: scale(0);
}

.featured-card:hover::before {
    transform: scale(1.5);
}

.featured-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.featured-header h4 {
    font-size: 1.3rem;
    margin-bottom: 0;
}

.featured-code {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: bold;
}

.featured-english {
    opacity: 0.9;
    margin-bottom: 15px;
    font-size: 1rem;
}

.featured-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.featured-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.featured-stat i {
    color: #ffd700;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    color: white;
}

.footer-content p {
    margin-bottom: 10px;
    opacity: 0.9;
}

.footer-content a {
    color: #ffd700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-content a:hover {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.footer-content i {
    margin-right: 8px;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4caf50;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error {
    background: #f44336;
}

.toast i {
    font-size: 1.2rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #ddd;
}

.no-results p {
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 2rem;
    }

    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .provinces-grid {
        grid-template-columns: 1fr;
        max-height: 400px;
    }

    .stats-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .featured-grid {
        grid-template-columns: 1fr;
    }

    .search-container {
        margin: 0 10px;
    }

    .language-toggle {
        position: static;
        transform: none;
        margin-top: 10px;
        justify-content: center;
    }

    #search-input {
        padding-bottom: 60px;
    }

    .provinces-section,
    .details-card,
    .featured-section {
        padding: 20px;
    }

    .toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-number {
        font-size: 1.8rem;
    }

    .province-card {
        padding: 15px;
    }

    .province-name {
        font-size: 1.1rem;
    }

    .featured-stats {
        flex-direction: column;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .loading,
    .toast,
    footer {
        display: none;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}