/* ===== CSS Variables - Custom Branding ===== */
:root {
    /* Brand Colors from Image */
    --brand-teal-dark: hsl(180, 100%, 15%);
    --brand-teal: hsl(174, 100%, 25%);
    --brand-teal-light: hsl(168, 60%, 35%);
    --brand-cream: hsl(40, 20%, 95%);

    /* Functional Colors */
    --primary: var(--brand-teal);
    --primary-dark: var(--brand-teal-dark);
    --secondary: hsl(168, 70%, 45%);
    --background: hsl(180, 30%, 8%);
    --card-bg: hsla(180, 25%, 12%, 0.9);
    --card-border: hsla(174, 100%, 25%, 0.3);
    --text: hsl(40, 20%, 95%);
    --text-muted: hsl(40, 10%, 70%);
    --success: hsl(140, 70%, 50%);
    --warning: hsl(40, 100%, 60%);
    --error: hsl(0, 70%, 60%);
    --buy-color: hsl(140, 70%, 50%);
    --sell-color: hsl(0, 70%, 60%);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, var(--brand-teal-dark) 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 2rem 1rem;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, hsla(174, 100%, 25%, 0.15) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-teal) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    filter: drop-shadow(0 0 20px hsla(174, 100%, 25%, 0.3));
}

.title-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 20px hsla(174, 100%, 25%, 0.5));
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* ===== Stale Reminder ===== */
.stale-reminder {
    background: linear-gradient(135deg, hsla(40, 100%, 60%, 0.2) 0%, hsla(40, 100%, 50%, 0.1) 100%);
    border: 1px solid hsla(40, 100%, 60%, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--warning);
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
    backdrop-filter: blur(10px);
}

.stale-reminder.hidden {
    display: none;
}

.reminder-icon {
    font-size: 1.5rem;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* ===== Main Content ===== */
.main-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-teal) 0%, var(--secondary) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--brand-teal);
    box-shadow: 0 10px 40px hsla(174, 100%, 25%, 0.3);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.card-badge {
    background: hsla(174, 100%, 25%, 0.3);
    color: var(--brand-teal-light);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid hsla(174, 100%, 25%, 0.4);
    flex-shrink: 0;
    white-space: nowrap;
}

.buy-badge {
    background: hsla(140, 70%, 50%, 0.2);
    color: var(--buy-color);
    border-color: hsla(140, 70%, 50%, 0.3);
}

.sell-badge {
    background: hsla(0, 70%, 60%, 0.2);
    color: var(--sell-color);
    border-color: hsla(0, 70%, 60%, 0.3);
}

.average-badge {
    background: hsla(168, 70%, 45%, 0.2);
    color: var(--secondary);
    border-color: hsla(168, 70%, 45%, 0.3);
}

.card-body {
    text-align: center;
}

.price-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.currency-symbol {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 300;
}

.price-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--brand-cream) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.price-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 300;
}

/* ===== Footer ===== */
.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.update-info {
    text-align: center;
}

.last-update {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 300;
}

.refresh-btn {
    background: linear-gradient(135deg, var(--brand-teal) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px hsla(174, 100%, 25%, 0.4);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px hsla(174, 100%, 25%, 0.6);
}

.refresh-btn:active {
    transform: translateY(0);
}

.refresh-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.refresh-btn.loading .btn-icon {
    animation: spin 1s linear infinite;
}

.btn-icon {
    font-size: 1.3rem;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: hsla(180, 30%, 8%, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid hsla(174, 100%, 25%, 0.2);
    border-top-color: var(--brand-teal);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 500;
}

/* ===== Calculator Section ===== */
.calculator-section {
    margin-bottom: 3rem;
}

.calculator-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
}

.calculator-header {
    text-align: center;
    margin-bottom: 2rem;
}

.calculator-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.calculator-icon {
    font-size: 1.8rem;
}

.calculator-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.calculator-body {
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: 2rem;
}

.input-label {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.currency-select {
    width: 100%;
    background: hsla(180, 25%, 8%, 0.8);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.currency-select:focus {
    outline: none;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px hsla(174, 100%, 25%, 0.2);
}

.currency-select option {
    background: hsl(180, 25%, 12%);
    color: var(--text);
    padding: 0.5rem;
}

.amount-input,
.bolivares-input {
    width: 100%;
    background: hsla(180, 25%, 8%, 0.8);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    color: var(--text);
    text-align: center;
    transition: all 0.3s ease;
}

.amount-input:focus,
.bolivares-input:focus {
    outline: none;
    border-color: var(--brand-teal);
    box-shadow: 0 0 0 3px hsla(174, 100%, 25%, 0.2);
}

.amount-input::placeholder,
.bolivares-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.result-item {
    background: hsla(180, 25%, 8%, 0.6);
    border: 1px solid hsla(174, 100%, 25%, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: var(--brand-teal);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px hsla(174, 100%, 25%, 0.2);
}

.result-item.selected-currency {
    border-color: var(--brand-teal);
    background: hsla(174, 100%, 25%, 0.15);
    box-shadow: 0 0 20px hsla(174, 100%, 25%, 0.3);
}

.result-item.selected-currency .result-value {
    color: var(--brand-teal);
}

.result-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px hsla(174, 100%, 25%, 0.3));
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
}

.result-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
}

.result-value {
    color: var(--brand-teal-light);
    font-size: 1.3rem;
    font-weight: 700;
}

/* ===== Responsive Design ===== */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
    }

    .container {
        padding: 0;
    }

    /* Header */
    .header {
        margin-bottom: 2rem;
    }

    .title {
        font-size: 2rem;
        gap: 0.5rem;
    }

    .title-icon {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    /* Stale Reminder */
    .stale-reminder {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    /* Main Content Grid */
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    /* Cards */
    .card {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .card-header {
        margin-bottom: 1rem;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .card-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }

    .price-display {
        margin-bottom: 0.25rem;
    }

    .currency-symbol {
        font-size: 1.2rem;
    }

    .price-value {
        font-size: 2rem;
    }

    .price-label {
        font-size: 0.85rem;
    }

    /* Calculator */
    .calculator-section {
        margin-bottom: 2rem;
    }

    .calculator-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .calculator-header {
        margin-bottom: 1.5rem;
    }

    .calculator-title {
        font-size: 1.3rem;
        gap: 0.5rem;
    }

    .calculator-icon {
        font-size: 1.5rem;
    }

    .calculator-subtitle {
        font-size: 0.9rem;
    }

    .input-group {
        margin-bottom: 1.5rem;
    }

    .input-label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .currency-select,
    .amount-input {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        border-radius: 10px;
    }

    .amount-input {
        font-size: 1.3rem;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .result-item {
        padding: 1rem;
        border-radius: 10px;
    }

    .result-icon {
        font-size: 1.5rem;
    }

    .result-label {
        font-size: 0.8rem;
    }

    .result-value {
        font-size: 1.1rem;
    }

    /* Footer */
    .footer {
        gap: 1.25rem;
        margin-bottom: 1rem;
    }

    .last-update {
        font-size: 0.85rem;
    }

    .refresh-btn {
        padding: 0.875rem 2rem;
        font-size: 1rem;
        border-radius: 40px;
    }

    .btn-icon {
        font-size: 1.2rem;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    body {
        padding: 0.75rem 0.5rem;
    }

    /* Header */
    .header {
        margin-bottom: 1.5rem;
    }

    .title {
        font-size: 1.75rem;
        flex-direction: column;
        gap: 0.25rem;
    }

    .title-icon {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    /* Stale Reminder */
    .stale-reminder {
        padding: 0.75rem 0.875rem;
        font-size: 0.85rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .reminder-icon {
        font-size: 1.25rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
        border-radius: 14px;
    }

    .card-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .price-value {
        font-size: 1.75rem;
    }

    .currency-symbol {
        font-size: 1rem;
    }

    .price-label {
        font-size: 0.8rem;
    }

    /* Calculator */
    .calculator-card {
        padding: 1.25rem;
    }

    .calculator-header {
        margin-bottom: 1.25rem;
    }

    .calculator-title {
        font-size: 1.2rem;
        flex-direction: column;
        gap: 0.25rem;
    }

    .calculator-icon {
        font-size: 1.5rem;
    }

    .calculator-subtitle {
        font-size: 0.85rem;
    }

    .input-group {
        margin-bottom: 1.25rem;
    }

    .currency-select,
    .amount-input {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .amount-input {
        font-size: 1.2rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }

    .result-item {
        padding: 0.875rem;
        flex-direction: row;
        justify-content: space-between;
    }

    .result-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .result-icon {
        font-size: 1.5rem;
    }

    .result-label {
        font-size: 0.85rem;
    }

    .result-value {
        font-size: 1.1rem;
        text-align: right;
    }

    /* Footer */
    .footer {
        gap: 1rem;
    }

    .last-update {
        font-size: 0.8rem;
    }

    .refresh-btn {
        padding: 0.75rem 1.75rem;
        font-size: 0.95rem;
        width: 100%;
        justify-content: center;
    }

    .btn-text {
        display: none;
    }

    .btn-icon {
        font-size: 1.5rem;
    }
}

/* Very small mobile (360px and below) */
@media (max-width: 360px) {
    .title {
        font-size: 1.5rem;
    }

    .price-value {
        font-size: 1.5rem;
    }

    .result-value {
        font-size: 1rem;
    }
}

/* ===== Desktop Optimization (1024px and above) ===== */
@media (min-width: 1024px) {
    body {
        padding: 3rem 2rem;
    }

    .container {
        max-width: 1400px;
    }

    /* Header */
    .header {
        margin-bottom: 4rem;
    }

    .title {
        font-size: 3.5rem;
        gap: 1.5rem;
        margin-bottom: 1rem;
    }

    .title-icon {
        font-size: 3.5rem;
    }

    .subtitle {
        font-size: 1.4rem;
    }

    /* Stale Reminder */
    .stale-reminder {
        padding: 1.5rem 2rem;
        font-size: 1.1rem;
        margin-bottom: 3rem;
    }

    .reminder-icon {
        font-size: 2rem;
    }

    /* Main Content Grid */
    .main-content {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 2rem;
        margin-bottom: 4rem;
    }

    /* Cards */
    .card {
        padding: 2.5rem;
        border-radius: 24px;
        border-width: 2px;
    }

    .card-header {
        margin-bottom: 2rem;
    }

    .card-title {
        font-size: 1.4rem;
    }

    .card-badge {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
    }

    .price-display {
        margin-bottom: 1rem;
    }

    .currency-symbol {
        font-size: 2rem;
    }

    .price-value {
        font-size: 3.5rem;
    }

    .price-label {
        font-size: 1.1rem;
    }

    /* Calculator Section */
    .calculator-section {
        margin-bottom: 4rem;
    }

    .calculator-card {
        padding: 3rem;
        border-radius: 24px;
        border-width: 2px;
    }

    .calculator-header {
        margin-bottom: 3rem;
    }

    .calculator-title {
        font-size: 2rem;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .calculator-icon {
        font-size: 2.5rem;
    }

    .calculator-subtitle {
        font-size: 1.15rem;
    }

    .calculator-body {
        max-width: 800px;
    }

    .input-group {
        margin-bottom: 2.5rem;
    }

    .input-label {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .currency-select {
        padding: 1.25rem 1.75rem;
        font-size: 1.2rem;
        border-radius: 14px;
    }

    .amount-input {
        padding: 1.25rem 1.75rem;
        font-size: 2rem;
        border-radius: 14px;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .result-item {
        padding: 1.75rem;
        border-radius: 14px;
    }

    .result-icon {
        font-size: 2.5rem;
    }

    .result-label {
        font-size: 1rem;
    }

    .result-value {
        font-size: 1.6rem;
    }

    /* Footer */
    .footer {
        gap: 2rem;
    }

    .last-update {
        font-size: 1.1rem;
    }

    .refresh-btn {
        padding: 1.25rem 3rem;
        font-size: 1.2rem;
        border-radius: 60px;
    }

    .btn-icon {
        font-size: 1.5rem;
    }
}

/* ===== Large Desktop (1440px and above) ===== */
@media (min-width: 1440px) {
    .container {
        max-width: 1600px;
    }

    .main-content {
        grid-template-columns: repeat(5, 1fr);
        gap: 2.5rem;
    }

    .card {
        padding: 3rem;
    }

    .price-value {
        font-size: 4rem;
    }

    .calculator-body {
        max-width: 900px;
    }

    .results-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}