/* ========================================
   Gold & Silver Price Calculator - Custom Styles
   Mobile-First, Premium Design
   ======================================== */

/* Tool Header */
.tool-header {
    padding: 20px 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
    transition: var(--transition-fast);
}

.back-link:hover {
    color: var(--text-primary);
}

.tool-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-icon-large {
    font-size: 2rem;
}

.tool-title-section h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.tool-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Calculator Section */
.calculator-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Rate Display Grid (Large) */
.rates-display-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 8px;
}

.rate-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
}

.rate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), transparent 60%);
    pointer-events: none;
}

.rate-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.flag-icon {
    font-size: 1.2rem;
}

.rate-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rate-value-wrapper {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 4px;
}

.currency {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 500;
}

.rate-amount {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.03em;
}

.unit {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 2px;
}

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

.metal-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

.rate-change {
    font-size: 0.85rem;
    font-weight: 700;
}

.change-up {
    color: #4ade80;
}

.change-down {
    color: #f87171;
}

/* Specific Card Styles */
.nepal-rate .rate-amount {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intl-rate .rate-amount {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Tablet Layout for Rates */
@media (min-width: 600px) {
    .rates-display-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .rate-amount {
        font-size: 3rem;
    }
}

/* Calc Card - Glassmorphism */
.calc-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Metal Selector - Modern Pills */
.metal-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 16px;
}

.metal-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.metal-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.metal-btn.active {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(234, 179, 8, 0.1));
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.1);
}

.metal-btn[data-metal="silver"].active {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.1));
    border-color: rgba(148, 163, 184, 0.3);
    box-shadow: 0 4px 12px rgba(148, 163, 184, 0.1);
}

.metal-btn[data-metal="tejabi"].active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.1));
    border-color: rgba(245, 158, 11, 0.3);
}

.metal-icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.metal-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metal-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.metal-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Inputs Area */
.calc-inputs {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr;
    /* Stack on mobile */
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-left: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    color: #eab308;
    letter-spacing: normal;
}

/* Modern Input Fields */
.input-field {
    width: 100%;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 600;
    outline: none;
    transition: all 0.3s ease;
}

.input-field:focus {
    background: rgba(234, 179, 8, 0.05);
    border-color: rgba(234, 179, 8, 0.3);
    box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.1);
}

/* Custom Select Dropdown */
select.input-field {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
    cursor: pointer;
}

/* Rate Input Wrapper */
.rate-input-wrapper {
    position: relative;
}

.live-active {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.rate-input-wrapper .input-field {
    padding-left: 50px;
    font-family: 'Monaco', 'Consolas', monospace;
    letter-spacing: -0.5px;
    font-size: 1.25rem;
}

.currency-symbol {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1rem;
    pointer-events: none;
}

/* Rate Presets */
.rate-presets {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.preset-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.preset-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.3);
    color: #eab308;
    transform: translateY(-1px);
}

/* Results Section */
.results-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
}

.result-total-card {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.total-label-sm {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.total-value-lg {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}

/* Breakdown Grid */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.breakdown-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.bd-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bd-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Info Card */
.info-card {
    margin-top: 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
}

.info-card h3 {
    font-size: 0.95rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.conversion-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conv-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    font-size: 0.9rem;
}

.conv-row span:nth-child(2) {
    color: var(--text-muted);
    font-weight: 300;
    opacity: 0.5;
}

.conv-row span:last-child {
    font-weight: 600;
    color: #eab308;
}


/* ========================================
   Tablet (600px+)
   ======================================== */
@media (min-width: 600px) {
    .tool-header {
        padding: 28px 0;
    }

    .tool-title-section h1 {
        font-size: 1.75rem;
    }

    .tool-icon-large {
        font-size: 2.5rem;
    }

    .input-row {
        grid-template-columns: 1fr 1fr;
        /* Two columns on tablet+ */
        gap: 20px;
    }

    .calc-card {
        padding: 32px;
    }

    .metal-btn {
        padding: 16px;
    }

    .metal-icon {
        font-size: 1.75rem;
    }

    .metal-name {
        font-size: 0.95rem;
    }

    .breakdown-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .total-value-lg {
        font-size: 3rem;
    }
}

/* ========================================
   Desktop (900px+)
   ======================================== */
@media (min-width: 900px) {
    .tool-header {
        padding: 36px 0;
    }

    .calculator-section {
        max-width: 800px;
        /* Constrain width for better readability */
        margin: 0 auto;
    }

    .tool-title-section h1 {
        font-size: 2rem;
    }

    .tool-icon-large {
        font-size: 3rem;
    }

    .calc-card {
        padding: 40px;
    }

    .metal-selector {
        padding: 6px;
        gap: 12px;
        margin-bottom: 32px;
    }

    .metal-btn {
        padding: 20px;
    }

    .input-field {
        font-size: 1.2rem;
        padding: 18px 24px;
    }
}