:root {
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-1: #38bdf8;
    --accent-2: #818cf8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
    --card-hover: rgba(51, 65, 85, 0.8);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 10s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-1) 0%, transparent 70%);
}

.orb-2 {
    bottom: -20%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-2) 0%, transparent 70%);
    animation-delay: -5s;
}

.orb-3 {
    top: 40%;
    left: 50%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #c084fc 0%, transparent 70%);
    opacity: 0.2;
    transform: translate(-50%, -50%);
    animation: pulse 8s infinite alternate ease-in-out;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-50%, -50%) scale(1.2); }
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Footer Navigation */
.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.9rem;
    margin-top: 2rem;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border-color);
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-links a:hover {
    color: var(--text-main);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    margin-top: 2rem;
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.api-link {
    display: inline-flex;
    align-items: center;
    color: var(--accent-1);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.api-link:hover {
    background: rgba(56, 189, 248, 0.2);
    transform: translateY(-1px);
}

/* Search Section */
.search-section {
    margin-bottom: 3rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-bar-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    flex: 1 1 300px;
}

.status-dropdown {
    padding: 1.2rem 1.5rem;
    font-size: 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    color: var(--text-main);
    backdrop-filter: var(--glass-blur);
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 3rem;
}

.status-dropdown:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.status-dropdown option {
    background-color: var(--bg-dark);
    color: var(--text-main);
}


.search-bar-container input {
    width: 100%;
    padding: 1.2rem 1.5rem 1.2rem 3.5rem;
    font-size: 1.1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    color: var(--text-main);
    backdrop-filter: var(--glass-blur);
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.search-bar-container input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Results Section */
.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.hidden {
    display: none !important;
}

/* Card */
.country-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: var(--glass-blur);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.country-card:hover {
    transform: translateY(-5px);
    background: var(--card-hover);
    border-color: var(--accent-2);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.country-name {
    font-size: 1.25rem;
    font-weight: 600;
}

.country-code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent-1);
}

.country-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Loading & No Results */
.loading-indicator, .no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent-1);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 1rem auto;
}

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

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.hidden .modal-content {
    transform: translateY(20px);
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2.5rem;
}

.modal-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-item {
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 12px;
}

.detail-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 1rem;
}

.status-officially-assigned {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-other {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.more-details-btn {
    margin-top: 1.5rem;
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.more-details-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.extended-details {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.list-item {
    background: rgba(0,0,0,0.2);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    .title {
        font-size: 2.25rem;
    }
    .subtitle {
        font-size: 0.95rem;
    }
    .countries-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .search-bar-container input {
        padding: 1rem 1rem 1rem 2.8rem;
        font-size: 1rem; /* Prevents iOS auto-zoom */
    }
    .modal-overlay {
        padding: 0.5rem;
    }
    .modal-body {
        padding: 1.5rem;
    }
    .modal-title {
        font-size: 1.5rem;
    }
    .close-btn {
        top: 0.75rem;
        right: 0.75rem;
    }
    .details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .detail-item {
        padding: 0.75rem;
    }
}
