/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #0f172a;
    color: #ffffff;
    height: 100dvh; /* Adapts to mobile browser UI */
    width: 100vw;
    overflow: hidden; /* Prevents whole-page scrolling */
    display: flex;
    justify-content: center;
    position: relative;
}




/* App Title Link Styles */
.app-title a {
    text-decoration: none;
    display: inline-block;
    position: relative;
    
    /* Vibrant metallic gradient text */
    background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 40%, #93c5fd 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
    /* Soft ambient text glow */
    filter: drop-shadow(0 2px 8px rgba(147, 197, 253, 0.25));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover & Mobile Touch State */
.app-title a:hover,
.app-title a:active {
    background-position: right center; /* Shifts gradient for a shimmer feel */
    transform: scale(1.03) translateY(-1px);
    filter: drop-shadow(0 4px 15px rgba(147, 197, 253, 0.5));
}

/* Animated gradient underline accent */
.app-title a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #a855f7);
    border-radius: 2px;
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
}

.app-title a:hover::after,
.app-title a:active::after {
    width: 85%;
}




/* Animated Ambient Background */
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out alternate;
}

.shape-1 {
    width: 300px; height: 300px;
    background: rgba(139, 92, 246, 0.4);
    top: -10%; left: -10%;
}

.shape-2 {
    width: 250px; height: 250px;
    background: rgba(59, 130, 246, 0.4);
    bottom: -5%; right: -10%;
    animation-delay: -5s;
}

.shape-3 {
    width: 200px; height: 200px;
    background: rgba(236, 72, 153, 0.3);
    top: 40%; left: 50%;
    transform: translateX(-50%);
    animation-duration: 15s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(20px, 30px) scale(1.1); }
}

/* Main App Container */
.app-container {
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    position: relative;
}

/* Glassmorphism & 3D Utilities */
.glass-panel {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
}

.3d-depth {
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3), 
        inset 0 1px 2px rgba(255, 255, 255, 0.3),
        inset 0 -2px 5px rgba(0, 0, 0, 0.2);
}

.glass-btn {
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.05) 100%);
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 
        inset 0 2px 2px rgba(255,255,255,0.3), 
        inset 0 -2px 4px rgba(0,0,0,0.3),
        0 4px 10px rgba(0,0,0,0.2);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.glass-btn:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 
        inset 0 3px 5px rgba(0,0,0,0.4),
        0 2px 5px rgba(0,0,0,0.2);
}

.shiny {
    position: relative;
    overflow: hidden;
}

.shiny::after {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    animation: shine 4s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

/* Header & Dropdown */
.top-section {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex-shrink: 0;
    z-index: 100;
}

.app-title {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.custom-dropdown-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    padding-left: 5px;
    font-weight: 600;
}

.custom-dropdown {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.dropdown-selected {
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none; /* Let the parent div handle clicks */
}

.dropdown-arrow {
    width: 0; height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid white;
    transition: transform 0.3s ease;
}

.custom-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown List */
.dropdown-list {
    background: rgba(15, 23, 42, 0.85);
    position: absolute;
    top: 100%; left: 0; right: 0;
    margin-top: 10px;
    max-height: 40vh;
    overflow-y: auto;
    border-radius: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: none; /* Firefox */
}

.dropdown-list::-webkit-scrollbar { display: none; } /* Safari/Chrome */

.dropdown-list.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    padding: 15px 20px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:active {
    background: rgba(255,255,255,0.15);
}

/* Rates Container & Cards */
.rates-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 20px;
    scrollbar-width: none;
}
.rates-container::-webkit-scrollbar { display: none; }

.rate-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.2), 
        0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.4s ease forwards;
    opacity: 0;
    transform: translateY(15px);
}

.rate-card.top-currency {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3); /* Subtle gold tint for top currencies */
}

.currency-code {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.currency-rate {
    font-size: 1.15rem;
    font-weight: 600;
    color: #e2e8f0;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loader */
.loader-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: inherit;
    z-index: 200;
    border-radius: 20px;
}

.loader-container.hidden {
    display: none;
}

.glass-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
