/* CSS Custom Properties */
:root {
    --ifm-color-primary: #2ec4f1;
    --ifm-color-primary-dark: #1b7ca6;
    --ifm-color-primary-darker: #176b8a;
    --ifm-color-primary-darkest: #124e66;
    --ifm-color-primary-light: #5fd6f7;
    --ifm-color-primary-lighter: #8fe7fd;
    --ifm-color-primary-lightest: #c6f4ff;
    --ifm-code-font-size: 95%;
    --docusaurus-highlighted-code-line-bg: rgba(46, 196, 241, 0.07);
    --header-font-color: #181c24;
    --body-background: #f6fcff;
    --body-font-color: #181c24;
    --accent-gradient: linear-gradient(90deg, #2e4af1 0%, #5a2ef1 100%);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--body-background);
    min-height: 100vh;
    color: var(--body-font-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    color: var(--header-font-color);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(255, 255, 255, 0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
}

/* Price Controls */
.price-controls {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(46, 196, 241, 0.1);
    margin-top: 20px;
}

.price-controls label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--ifm-color-primary-darkest);
}

.price-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#btcPrice {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--ifm-color-primary-lighter);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    background: white;
    color: var(--body-font-color);
    transition: all 0.2s ease;
}

#btcPrice:focus {
    outline: none;
    border-color: var(--ifm-color-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(46, 196, 241, 0.1);
}

.refresh-btn {
    padding: 0.75rem 1rem;
    background: var(--ifm-color-primary);
    color: white;
    border: 2px solid var(--ifm-color-primary);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.refresh-btn:hover {
    background: var(--ifm-color-primary-dark);
    border-color: var(--ifm-color-primary-dark);
    transform: translateY(-1px);
}

.refresh-btn:active {
    transform: translateY(0);
}

/* Denominations Grid */
.denominations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.denomination-btn {
    background: white;
    border: 2px solid var(--ifm-color-primary-lighter);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(46, 196, 241, 0.1);
    color: var(--body-font-color);
    text-align: center;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.denomination-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(46, 196, 241, 0.2);
    border-color: var(--ifm-color-primary);
}

.denomination-btn.selected {
    background: var(--ifm-color-primary-dark);
    color: white;
    border-color: var(--ifm-color-primary-darkest);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 196, 241, 0.4);
}

.denomination-btn:active {
    transform: translateY(0);
}

/* Summary Section */
.summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

@media (max-width: 768px) {
    .summary {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Total Display */
.total-display {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(46, 196, 241, 0.1);
    text-align: center;
}

.total-display h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--header-font-color);
}

#totalAmount {
    color: var(--ifm-color-primary);
    font-weight: 700;
}

.usd-value {
    font-size: 1.2rem;
    color: var(--ifm-color-primary-dark);
    font-weight: 600;
    margin: 0.5rem 0;
    opacity: 0.9;
}

#usdAmount {
    color: var(--ifm-color-primary-darker);
}

.selected-count {
    font-size: 1.1rem;
    color: #718096;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

/* MSAT Values Display */
.msat-values {
    margin-top: 1.5rem;
}

.msat-values label {
    display: block;
    font-size: 0.9rem;
    color: var(--ifm-color-primary-darkest);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#msatValues {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--ifm-color-primary-lighter);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background-color: white;
    color: var(--body-font-color);
    transition: border-color 0.2s ease;
}

#msatValues:focus {
    outline: none;
    border-color: var(--ifm-color-primary);
    background-color: white;
}

.copy-btn {
    padding: 0.75rem 1rem;
    background: var(--ifm-color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-btn:hover:not(:disabled) {
    background: var(--ifm-color-primary-dark);
    transform: translateY(-1px);
}

.copy-btn:active:not(:disabled) {
    transform: translateY(0);
}

.copy-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    transform: none;
}

.copy-btn.copied {
    background: var(--ifm-color-primary-darker);
    animation: copySuccess 0.3s ease;
}

@keyframes copySuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* QR Code Display */
.qr-display {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(46, 196, 241, 0.1);
    text-align: center;
}

.qr-display h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--header-font-color);
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-height: 250px; /* Fixed height to prevent jumping */
}

#qrImage {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    object-fit: contain; /* Ensure image fits within fixed dimensions */
}

#qrImage:hover {
    transform: scale(1.05);
}

.qr-info {
    font-size: 1rem;
    color: #718096;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .price-input-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .refresh-btn {
        width: 100%;
    }

    .denominations-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    .denomination-btn {
        padding: 1rem 0.75rem;
        font-size: 1rem;
        min-height: 60px;
    }

    .total-display h2 {
        font-size: 1.5rem;
    }

    .qr-container {
        min-height: 200px; /* Smaller fixed height for mobile */
    }

    #qrImage {
        width: 150px;
        height: 150px;
    }
}

/* Animation for selection feedback */
@keyframes selectPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.denomination-btn.selected {
    animation: selectPulse 0.3s ease;
}

/* Focus styles for accessibility */
.denomination-btn:focus {
    outline: 3px solid var(--ifm-color-primary);
    outline-offset: 2px;
}

/* QR images are now preloaded, no loading state needed */

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--header-font-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    z-index: 1000;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.error {
    background: #e53e3e;
}

.toast.success {
    background: var(--ifm-color-primary-darker);
}

.toast.warning {
    background: #d69e2e;
}

/* Mobile responsive toast */
@media (max-width: 640px) {
    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }

    .toast.show {
        transform: translateY(0);
    }
}
