/* ==========================================================================
   Globalrate Custom Design System & CSS Rules
   ========================================================================== */

/* Variables Definition */
:root {
    /* Color Palette - Light Mode Default */
    --bg-primary: #f4f6fc;
    --bg-secondary: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.7);
    --border-glass: rgba(255, 255, 255, 0.8);
    --border-glow: rgba(99, 102, 241, 0.1);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --accent-primary: #6366f1; /* Indigo */
    --accent-primary-rgb: 99, 102, 241;
    --accent-secondary: #a855f7; /* Purple */
    --accent-success: #10b981; /* Emerald */
    --accent-warning: #f59e0b; /* Amber */
    --accent-danger: #ef4444; /* Rose */
    
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
    --card-radius: 20px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Background Glow Orbs */
    --orb-1-color: rgba(99, 102, 241, 0.15);
    --orb-2-color: rgba(168, 85, 247, 0.12);
}

/* Dark Mode Variables Override */
.theme-dark {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-glass: rgba(17, 24, 39, 0.75);
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(99, 102, 241, 0.25);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --orb-1-color: rgba(99, 102, 241, 0.2);
    --orb-2-color: rgba(168, 85, 247, 0.18);
}

/* System Preference Fallback */
@media (prefers-color-scheme: dark) {
    .theme-system {
        --bg-primary: #0b0f19;
        --bg-secondary: #111827;
        --bg-glass: rgba(17, 24, 39, 0.75);
        --border-glass: rgba(255, 255, 255, 0.06);
        --border-glow: rgba(99, 102, 241, 0.25);
        
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        
        --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
        
        --orb-1-color: rgba(99, 102, 241, 0.2);
        --orb-2-color: rgba(168, 85, 247, 0.18);
    }
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.3s ease;
}

/* App Background Orbs */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
}

.orb-1 {
    width: 50vw;
    height: 50vw;
    top: -10vw;
    left: -10vw;
    background-color: var(--orb-1-color);
    animation: float-slow 15s infinite alternate ease-in-out;
}

.orb-2 {
    width: 45vw;
    height: 45vw;
    bottom: -10vw;
    right: -10vw;
    background-color: var(--orb-2-color);
    animation: float-slow 18s infinite alternate-reverse ease-in-out;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 8%) scale(1.05); }
    100% { transform: translate(-3%, -5%) scale(0.95); }
}

/* App Container Layout */
.app-container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 30px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.logo-icon i {
    width: 22px;
    height: 22px;
}

.brand h1 {
    font-size: 26px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand h1 span {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* API Status Indicator */
.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 6px 14px;
    border-radius: 30px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--card-shadow);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.status-indicator.live {
    background-color: var(--accent-success);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    animation: pulse 1.8s infinite;
}

.status-indicator.error {
    background-color: var(--accent-danger);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.status-indicator.syncing {
    background-color: var(--accent-warning);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
    animation: pulse 1.0s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

/* Theme Switcher */
.theme-switch-container {
    display: flex;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--card-shadow);
}

.theme-btn {
    border: none;
    background: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.theme-btn i {
    width: 16px;
    height: 16px;
}

.theme-btn:hover {
    color: var(--text-primary);
}

.theme-btn.active {
    background: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* App Grid Layout */
.app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    flex-grow: 1;
}

.grid-col {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--card-shadow);
    border-radius: var(--card-radius);
    padding: 30px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: var(--transition-smooth);
}

.glass-card:hover::before {
    opacity: 1;
}

.glass-card:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.08), var(--border-glow) 0px 0px 1px 1px inset;
}

/* Card Header */
.card-header {
    margin-bottom: 24px;
}

.card-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
    display: inline-block;
}

/* Form Styles */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Input Wrapper & Styled Inputs */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol-prefix {
    position: absolute;
    left: 20px;
    font-size: 22px;
    font-weight: 600;
    color: var(--accent-primary);
    pointer-events: none;
}

.input-icon-left {
    position: absolute;
    left: 20px;
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 16px 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    transition: var(--transition-smooth);
    outline: none;
}

.amount-group .input-wrapper input {
    padding-left: 45px;
    padding-right: 50px;
}

.date-group .input-wrapper input {
    padding-left: 55px;
    font-size: 16px;
    font-weight: 500;
}

.input-wrapper input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.clear-btn {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.clear-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Currency Selector Row */
.currency-selector-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: end;
    gap: 16px;
    margin-bottom: 24px;
}

.currency-select-group {
    margin-bottom: 0;
}

.custom-select-trigger {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    cursor: pointer;
    transition: var(--transition-smooth);
    outline: none;
}

.custom-select-trigger:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.05);
}

.custom-select-trigger:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.selected-currency-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.currency-flag {
    width: 28px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.currency-code {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.select-chevron {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

/* Swap Action */
.swap-action-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 52px; /* aligns with trigger buttons */
}

.swap-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    color: var(--accent-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
}

.swap-btn:hover {
    background: var(--accent-primary);
    color: #ffffff;
    transform: rotate(180deg);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.35);
}

.swap-btn:active {
    transform: scale(0.9) rotate(180deg);
}

/* Result Box */
.conversion-result-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(168, 85, 247, 0.04));
    border-radius: 18px;
    border: 1px solid rgba(99, 102, 241, 0.08);
    padding: 24px;
    margin-top: 10px;
    position: relative;
}

.result-top {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.result-bottom {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.to-display-value {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    word-break: break-all;
}

.to-display-code {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.rate-info-line {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px dashed var(--border-glass);
    padding-top: 12px;
}

.exchange-rate-text,
.exchange-rate-text-reverse {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Pinned Favorites Dashboard */
.header-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add-favorite-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
    transition: var(--transition-smooth);
}

.add-favorite-btn:hover {
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.add-favorite-btn i {
    width: 14px;
    height: 14px;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    min-height: 100px;
}

.fav-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.fav-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.04);
}

.fav-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fav-flag-code {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fav-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
}

.fav-code {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
}

.fav-name-secondary {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 5px;
}

.fav-unpin-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    opacity: 0;
    transition: var(--transition-smooth);
}

.fav-card:hover .fav-unpin-btn {
    opacity: 1;
}

.fav-unpin-btn:hover {
    color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.05);
}

.fav-unpin-btn i {
    width: 14px;
    height: 14px;
}

.fav-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 2px;
}

.fav-label {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Trend Chart */
.chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.chart-timeframe-selector {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    padding: 3px;
    border-radius: 10px;
}

.time-btn {
    border: none;
    background: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.time-btn:hover {
    color: var(--text-primary);
}

.time-btn.active {
    background: var(--accent-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.25);
}

.chart-container-wrapper {
    position: relative;
    width: 100%;
    height: 250px;
    margin-top: 15px;
}

.chart-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-glass);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 5;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.chart-loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.chart-loading-overlay span {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Historical Lookup */
.lookup-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lookup-inputs {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 16px;
}

.lookup-inputs .date-group {
    margin-bottom: 0;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    color: #ffffff;
    height: 52px;
    padding: 0 24px;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
    transition: var(--transition-smooth);
}

.primary-btn:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.primary-btn:active {
    transform: scale(0.97);
}

.primary-btn i {
    width: 18px;
    height: 18px;
}

.lookup-result-box {
    background: var(--bg-secondary);
    border: 1px dashed var(--border-glass);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInUp 0.4s ease forwards;
}

.lookup-result-box.hidden {
    display: none;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lookup-date-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.08);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.lookup-rate-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 14px;
    width: 100%;
    justify-content: center;
}

.lookup-currency {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lookup-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.lookup-amount.highlight {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-primary);
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lookup-code {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 4px;
}

.lookup-rate-row .arrow-icon {
    color: var(--text-muted);
    width: 22px;
    height: 22px;
}

.lookup-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* Footer */
.app-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-glass);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-footer p {
    font-size: 12px;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.footer-links a {
    font-size: 12px;
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

.separator {
    color: var(--text-muted);
    font-size: 10px;
}

/* Modal Overlay Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.modal-overlay.hidden .modal-content {
    animation: modalSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalSlideDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(40px); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-close-btn i {
    width: 18px;
    height: 18px;
}

.modal-search-wrapper {
    padding: 16px 24px;
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
}

.modal-search-wrapper .search-icon {
    position: absolute;
    left: 40px;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.modal-search-wrapper input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 16px 12px 42px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition-smooth);
    outline: none;
}

.modal-search-wrapper input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-clear-btn {
    position: absolute;
    right: 36px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.search-clear-btn.hidden {
    display: none;
}

.search-clear-btn:hover {
    color: var(--text-primary);
}

.search-clear-btn i {
    width: 16px;
    height: 16px;
}

.currency-list-container {
    overflow-y: auto;
    flex-grow: 1;
    padding: 12px;
}

/* Custom Scrollbar for list container */
.currency-list-container::-webkit-scrollbar {
    width: 6px;
}

.currency-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.currency-list-container::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
    opacity: 0.3;
}

.currency-list-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.currency-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 4px;
}

.currency-item:hover {
    background: var(--bg-secondary);
    transform: translateX(4px);
}

.currency-item.active {
    background: rgba(99, 102, 241, 0.08);
}

.currency-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.currency-item-flag {
    width: 32px;
    height: 22px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.currency-item-codes {
    display: flex;
    flex-direction: column;
}

.currency-item-code {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.currency-item-name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.currency-item-active-icon {
    color: var(--accent-primary);
    width: 18px;
    height: 18px;
    display: none;
}

.currency-item.active .currency-item-active-icon {
    display: block;
}

/* Skeleton Loading Screen */
.skeleton-loader {
    width: 100%;
    background: linear-gradient(90deg, 
        rgba(148, 163, 184, 0.06) 25%, 
        rgba(148, 163, 184, 0.15) 37%, 
        rgba(148, 163, 184, 0.06) 63%
    );
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: 12px;
}

@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Lucide animation triggers */
.icon-spin-hover:hover {
    animation: spin 2s linear infinite;
}

/* ==========================================================================
   Responsive Media Queries (Mobile & Tablet)
   ========================================================================== */
.mobile-nav-bar {
    display: none; /* Hidden on desktop */
}

@media (max-width: 1024px) {
    .app-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media (max-width: 768px) {
    /* Setup container padding and leave room for floating bottom capsule nav */
    .app-container {
        padding: 12px 12px 100px 12px;
    }
    
    .app-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .brand h1 {
        font-size: 20px;
    }
    
    .logo-icon {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }
    
    .logo-icon i {
        width: 16px;
        height: 16px;
    }

    .header-controls {
        gap: 10px !important;
    }

    .status-text {
        display: none !important;
    }

    .api-status {
        padding: 0 !important;
        width: 34px;
        height: 34px;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .status-indicator {
        margin: 0 !important;
    }
    
    @keyframes tabContentSlideUp {
        from {
            opacity: 0;
            transform: translateY(12px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Mobile-first Tabbed System: Hide inactive cards on mobile view */
    .converter-card,
    .favorites-card,
    .chart-card,
    .lookup-card {
        display: none !important;
    }
    
    body[data-active-tab="converter"] .converter-card,
    body[data-active-tab="converter"] .favorites-card {
        display: flex !important;
        flex-direction: column;
        animation: tabContentSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    
    body[data-active-tab="chart"] .chart-card {
        display: flex !important;
        flex-direction: column;
        animation: tabContentSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    
    body[data-active-tab="lookup"] .lookup-card {
        display: flex !important;
        flex-direction: column;
        animation: tabContentSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
    
    /* Interactive Card Padding Adjustments to save vertical space */
    .glass-card {
        padding: 16px;
        border-radius: 16px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    /* Compact Text & Content Values on mobile */
    .input-wrapper input {
        font-size: 20px;
        padding: 12px 16px;
    }
    
    .amount-group .input-wrapper input {
        padding-left: 42px;
        padding-right: 42px;
    }
    
    .custom-select-trigger {
        padding: 11px 12px;
    }
    
    .selected-currency-info {
        gap: 8px;
    }
    
    .currency-code {
        font-size: 15px;
    }
    
    .currency-flag {
        width: 24px;
        height: 16px;
        border-radius: 2px;
    }

    .select-chevron {
        width: 14px;
        height: 14px;
    }
    
    .to-display-value {
        font-size: 28px;
        font-weight: 800;
    }
    
    .to-display-code {
        font-size: 18px;
    }
    
    .result-bottom {
        gap: 4px;
        margin-bottom: 4px;
    }

    .conversion-result-box {
        padding: 14px 16px;
        margin-top: 8px;
    }
    
    /* Single-row horizontal layout for currency selectors on mobile */
    .currency-selector-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-end !important;
        gap: 6px !important;
    }
    
    .currency-select-group {
        flex: 1 !important;
        min-width: 0 !important;
    }
    
    .swap-action-wrapper {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        height: 44px !important; /* Aligns with trigger height */
    }
    
    .swap-btn {
        width: 36px !important;
        height: 36px !important;
        transform: none !important; /* Keep horizontal arrow direction */
    }
    
    .swap-btn:hover {
        transform: scale(1.05) !important;
    }
    
    .swap-btn:active {
        transform: scale(0.9) !important;
    }
    
    .favorites-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .fav-card {
        padding: 14px;
    }
    
    .fav-value {
        font-size: 22px;
    }
    
    .chart-container-wrapper {
        height: 280px; /* Taller chart area on mobile for readability */
    }
    
    .lookup-inputs {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .primary-btn {
        width: 100%;
        height: 48px;
    }
    
    /* Mobile Floating Capsule Tab Bar (High-Fidelity Frosted Glass Optimized) */
    .mobile-nav-bar {
        display: flex;
        position: fixed;
        bottom: calc(16px + env(safe-area-inset-bottom));
        left: 24px;
        right: 24px;
        height: 60px;
        background: rgba(255, 255, 255, 0.35);
        backdrop-filter: blur(25px) saturate(200%);
        -webkit-backdrop-filter: blur(25px) saturate(200%);
        border: 1px solid rgba(255, 255, 255, 0.25);
        border-radius: 30px;
        justify-content: space-around;
        align-items: center;
        z-index: 90;
        /* Beveled 3D shine shadow recipe for realistic glass thickness */
        box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.08), 
                    inset 0 1px 0px 0px rgba(255, 255, 255, 0.7), 
                    inset 0 -1px 0px 0px rgba(0, 0, 0, 0.02);
        padding: 0 6px;
        transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
    }
    
    .theme-dark .mobile-nav-bar {
        background: rgba(17, 24, 39, 0.35);
        border: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.4), 
                    inset 0 1px 0px 0px rgba(255, 255, 255, 0.12), 
                    inset 0 -1px 0px 0px rgba(0, 0, 0, 0.2);
    }
    
    @media (prefers-color-scheme: dark) {
        .theme-system .mobile-nav-bar {
            background: rgba(17, 24, 39, 0.35);
            border: 1px solid rgba(255, 255, 255, 0.06);
            box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.4), 
                        inset 0 1px 0px 0px rgba(255, 255, 255, 0.12), 
                        inset 0 -1px 0px 0px rgba(0, 0, 0, 0.2);
        }
    }
    
    /* Sliding pill indicator under the active tab icon */
    .nav-indicator {
        position: absolute;
        top: 5px;
        bottom: 5px;
        left: 6px;
        width: calc((100% - 12px) / 3);
        background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
        border-radius: 25px;
        z-index: 1;
        box-shadow: 0 6px 14px rgba(99, 102, 241, 0.25);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        pointer-events: none; /* Let touches pass through to clickable buttons */
    }
    
    /* Sliding Pill Capsule buttons inside the glass bar */
    .nav-tab {
        background: none;
        border: none;
        color: var(--text-secondary);
        opacity: 0.6;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 0;
        cursor: pointer;
        flex-grow: 1;
        height: calc(100% - 10px);
        margin: 5px 0; /* Fit indicator width calculation perfectly */
        border-radius: 25px;
        outline: none;
        position: relative;
        z-index: 2; /* Sit on top of sliding indicator */
        transition: all 0.3s ease;
    }
    
    .nav-tab i {
        width: 18px;
        height: 18px;
        color: var(--text-secondary);
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s;
    }
    
    .nav-tab span {
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.2px;
        color: var(--text-secondary);
        transition: color 0.3s;
    }
    
    .nav-tab:active {
        background: rgba(99, 102, 241, 0.03);
    }
    
    /* Active State styles - white text on sliding gradient indicator background */
    .nav-tab.active {
        opacity: 1;
        color: #ffffff !important;
    }
    
    .nav-tab.active i {
        color: #ffffff !important;
        transform: translateY(-1px) scale(1.08);
    }
    
    .nav-tab.active span {
        color: #ffffff !important;
    }
    
    /* Custom Currency Selection Modal: Native Bottom Sheet style on mobile */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .modal-content {
        max-height: 80vh;
        border-radius: 24px 24px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        animation: bottomSheetSlideUp 0.35s cubic-bezier(0.32, 0.94, 0.6, 1) forwards;
    }
    
    .modal-overlay.hidden .modal-content {
        animation: bottomSheetSlideDown 0.3s cubic-bezier(0.32, 0.94, 0.6, 1) forwards;
    }
    
    @keyframes bottomSheetSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    @keyframes bottomSheetSlideDown {
        from { transform: translateY(0); }
        to { transform: translateY(100%); }
    }
    
    .currency-item {
        padding: 14px 18px; /* Taller tap target for finger taps */
    }
    
    .currency-item-flag {
        width: 36px;
        height: 24px;
    }
    
    .currency-item-code {
        font-size: 15px;
    }
    
    .currency-item-name {
        font-size: 12px;
    }
    
    .modal-search-wrapper {
        padding: 12px 18px;
    }
    
    .modal-search-wrapper input {
        padding: 12px 14px 12px 38px;
    }
    
    .modal-search-wrapper .search-icon {
        left: 32px;
    }
    
    .search-clear-btn {
        right: 28px;
    }
}

