/**
 * NPR Currency Converter Styles - Modern Inline Design (Revamped)
 */

.npr-converter-wrapper {
    max-width: 100%;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    /* Theme Variables */
    --npr-primary: #4CAF50;
    --npr-primary-rgb: 76,175,80;
    --npr-bg: #f7f8fa;
    --npr-surface: #ffffff;
    --npr-border: #dde2e7;
    --npr-border-strong: #c0c8cf;
    --npr-radius-sm: 6px;
    --npr-radius: 10px;
    --npr-radius-lg: 18px;
    --npr-shadow: 0 4px 12px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.06);
    --npr-shadow-hover: 0 8px 28px rgba(0,0,0,0.08), 0 4px 14px rgba(0,0,0,0.06);
    --npr-transition: cubic-bezier(.4,0,.2,1) 260ms;
}

.npr-converter-container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    max-width: 100%;
    margin: 0 auto;
    border: none;
}

/* Inline Currency Cards Layout */
.npr-converter-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* Individual Currency Card */
.npr-currency-card {
    position: relative;
    background: var(--npr-surface);
    border: 1px solid var(--npr-border);
    border-radius: var(--npr-radius);
    padding: 14px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 150px;
    isolation: isolate;
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    box-shadow: var(--npr-shadow);
    transition: var(--npr-transition);
    overflow: hidden;
}

.npr-currency-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(var(--npr-primary-rgb),0.08) 0%, rgba(var(--npr-primary-rgb),0) 60%);
    opacity: 0;
    pointer-events: none;
    transition: var(--npr-transition);
}

.npr-currency-card[data-role="source"]::after {
    content: "SOURCE";
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .5px;
    color: var(--npr-primary);
    background: rgba(var(--npr-primary-rgb),0.12);
    padding: 3px 6px;
    border-radius: var(--npr-radius-sm);
}

/* Extra top padding so input doesn't collide with SOURCE badge */
.npr-currency-card[data-role="source"] {
    padding-top: 40px; /* was 14px; create space for badge */
}

/* Tighten badge position a little after increasing padding */
.npr-currency-card[data-role="source"]::after {
    top: 10px;
}

.npr-currency-card:hover {
    transform: translateY(-4px);
    border-color: var(--npr-border-strong);
    box-shadow: var(--npr-shadow-hover);
}

.npr-currency-card:hover::before { opacity: 1; }

.npr-currency-card:focus-within {
    border-color: var(--npr-primary);
    box-shadow: 0 0 0 3px rgba(var(--npr-primary-rgb),0.25), var(--npr-shadow);
}

/* Card Amount */
.npr-card-amount {
    font-size: 20px;
    font-weight: 600;
    color: #111;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
}

.npr-amount-input,
.npr-card-input {
    width: 100%;
    font-size: 20px;
    font-weight: 600;
    color: #111;
    border: 1px solid transparent;
    outline: none;
    padding: 2px 0 0;
    background: transparent;
    font-family: inherit;
    transition: var(--npr-transition);
}

.npr-card-input:focus,
.npr-amount-input:focus {
    border-color: var(--npr-primary);
}

.npr-amount-input::-webkit-inner-spin-button,
.npr-amount-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Card Currency Info */
.npr-card-currency {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
    position: relative;
}

/* Currency select modern styling */
.npr-currency-select {
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--npr-border);
    background: linear-gradient(180deg,#fff 0%,#f1f3f5 100%);
    padding: 6px 28px 6px 10px;
    color: #222;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    border-radius: var(--npr-radius-sm);
    line-height: 1.2;
    position: relative;
    transition: var(--npr-transition);
}
.npr-currency-select:hover { border-color: var(--npr-border-strong); }
.npr-currency-select:focus { outline:none; border-color: var(--npr-primary); box-shadow: 0 0 0 3px rgba(var(--npr-primary-rgb),0.25); }
.npr-currency-select option { color:#222; }

/* Position arrow inside select relative to select itself */
.npr-currency-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 5l4.5 4.5L11.5 5'/%3E%3C/svg%3E");
    background-position: right 10px center;
    background-repeat: no-repeat;
    background-size: 14px 14px;
}

.npr-flag {
    font-size: 18px;
    line-height: 1;
}

.npr-code {
    font-weight: 500;
    color: #1a1a1a;
}

.npr-dropdown {
    font-size: 10px;
    color: #999;
    margin-left: auto;
}

/* Arrow Icon */
.npr-arrow-icon {
    color: #999;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 4px;
}

.npr-arrow-icon svg {
    width: 20px;
    height: 20px;
}

/* Error Message */
.npr-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* Footer */
.npr-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #666;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.npr-footer-left {
    color: #888;
}

.npr-footer-right {
    color: #666;
}

.npr-footer-right strong {
    color: #1a1a1a;
    font-weight: 600;
}

/* Value flash on update */
.npr-flash {
    animation: npr-flash 900ms var(--npr-transition);
}
@keyframes npr-flash {
    0% { background: rgba(var(--npr-primary-rgb),0.18); }
    50% { background: rgba(var(--npr-primary-rgb),0.08); }
    100% { background: transparent; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .npr-converter-inline { gap: 14px; }
    .npr-currency-card { min-width: 130px; padding: 12px 14px 14px; }
    .npr-card-amount, .npr-amount-input, .npr-card-input { font-size: 18px; }
}

@media (max-width: 600px) {
    .npr-converter-inline { 
        flex-direction: column; 
        align-items: stretch; 
        position: relative;
    }
    
    .npr-currency-card { 
        min-width: 100%; 
        backdrop-filter: none; 
    }
    
    /* Show arrow vertically between source and targets on mobile */
    .npr-arrow-icon {
        display: flex !important;
        position: relative;
        align-self: center;
        margin: 8px 0;
        color: var(--npr-primary);
    }
    
    .npr-arrow-icon svg {
        transform: rotate(90deg);
        width: 24px;
        height: 24px;
    }
    
    .npr-footer { 
        flex-direction: column; 
        gap: 8px; 
        align-items: flex-start; 
        text-align: left; 
    }
}
    font-weight: 500;
}

.npr-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(76, 175, 80, 0.2);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: npr-spin 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    margin-right: 10px;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}

@keyframes npr-spin {
    to { transform: rotate(360deg); }
}

.npr-error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 5px solid #e53935;
    padding: 18px 20px;
    margin-bottom: 24px;
    border-radius: 12px;
    color: #c62828;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.15);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.npr-results {
    animation: npr-fadein 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes npr-fadein {
    from { 
        opacity: 0; 
        transform: translateY(20px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.npr-results h4 {
    text-align: center;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 28px 0;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.npr-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Horizontal Layout - Single Row */
.npr-results-grid.npr-layout-horizontal {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start;
    align-items: stretch;
    gap: 12px;
    grid-template-columns: unset;
    overflow-x: auto;
    padding-bottom: 10px;
}

.npr-results-grid.npr-layout-horizontal::-webkit-scrollbar {
    height: 8px;
}

.npr-results-grid.npr-layout-horizontal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.npr-results-grid.npr-layout-horizontal::-webkit-scrollbar-thumb {
    background: #4CAF50;
    border-radius: 10px;
}

.npr-layout-horizontal .npr-result-item {
    flex: 0 0 auto;
    min-width: 140px;
    max-width: 140px;
    padding: 20px 16px;
}

.npr-layout-horizontal .npr-currency-code {
    font-size: 18px;
}

.npr-layout-horizontal .npr-currency-name {
    font-size: 9px;
}

.npr-layout-horizontal .npr-amount {
    font-size: 16px;
}

.npr-result-item {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    padding: 24px 18px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid #e8ecef;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.npr-result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #4CAF50, transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.npr-result-item:hover {
    background: #ffffff;
    border-color: #4CAF50;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 28px rgba(76, 175, 80, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
}

.npr-result-item:hover::before {
    opacity: 1;
}

.npr-result-source {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.35);
}

.npr-result-source::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    opacity: 1;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.npr-result-source:hover {
    background: linear-gradient(135deg, #45a049 0%, #5cb860 100%);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 16px 36px rgba(76, 175, 80, 0.4), 0 6px 16px rgba(76, 175, 80, 0.2);
}

.npr-result-source .npr-currency-code,
.npr-result-source .npr-currency-name,
.npr-result-source .npr-amount {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.npr-currency-code {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.npr-currency-name {
    display: block;
    font-size: 11px;
    color: #7f8c8d;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.npr-amount {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: #4CAF50;
    margin-top: 10px;
    letter-spacing: -0.5px;
}

.npr-disclaimer {
    text-align: center;
    color: #95a5a6;
    margin: 20px 0 0 0;
    font-style: italic;
    font-size: 13px;
    padding: 12px 20px;
    background: rgba(149, 165, 166, 0.05);
    border-radius: 10px;
    border: 1px dashed rgba(149, 165, 166, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .npr-converter-inline {
        gap: 10px;
    }

    .npr-currency-card {
        min-width: 120px;
        padding: 10px 14px;
    }

    .npr-card-amount,
    .npr-amount-input {
        font-size: 18px;
    }

    .npr-arrow-icon {
        display: none;
    }
}

@media (max-width: 600px) {
    .npr-converter-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .npr-currency-card {
        min-width: 100%;
    }

    .npr-footer {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
        text-align: left;
    }
}
