/* ── Gold Spark Click Effect ──────────────────────────────────────────────── */

.gold-spark {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px 1px rgba(255, 215, 0, 0.6);
    animation: spark-fly linear forwards;
}

@keyframes spark-fly {
    0%   { opacity: 1;   transform: translate(-50%, -50%) translate(0, 0)       scale(1); }
    60%  { opacity: 0.8; transform: translate(-50%, -50%) translate(calc(var(--dx) * 0.7), calc(var(--dy) * 0.7)) scale(0.8); }
    100% { opacity: 0;   transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.2); }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M3 1 L3 17 L7 13 L10.5 19 L12.5 18 L9 12 L15 12 Z' fill='%23FFD700' stroke='%23B8860B' stroke-width='1'/%3E%3C/svg%3E") 3 1, auto !important;
}

button, a, select, input[type="range"], summary, .karat-tap-btn, .copy-btn, [onclick] {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M3 1 L3 17 L7 13 L10.5 19 L12.5 18 L9 12 L15 12 Z' fill='%23FFD700' stroke='%23B8860B' stroke-width='1'/%3E%3C/svg%3E") 3 1, pointer !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ff9ff3 0%, #ffd3f8 100%);
    min-height: 100vh;
    padding: 15px;
    color: #333;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: #ff0084;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    text-shadow: 2px 2px 0px rgba(255,255,255,0.7);
    letter-spacing: 2px;
}

header p {
    font-size: 1rem;
    color: #ff4da6;
}

.price-display {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(255,105,180,0.3);
    border: 2px solid #ff69b4;
}

.price-display h3 {
    color: #ff0084;
    margin-bottom: 10px;
}

#gold-price {
    font-size: 1.7rem;
    font-weight: bold;
    color: #ff69b4;
    margin-bottom: 10px;
}

.calculator-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
}

.calculator-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(255,105,180,0.3);
    border: 2px solid #ff69b4;
}

.calculator-card h2 {
    color: #ff0084;
    
    text-align: center;
    font-size: 1.4rem;
}

.calculator-card-explainer {
    border-bottom: 2px dashed #ff69b4;
    margin-bottom: 15px;
    padding-bottom: 8px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #ff0084;
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ffb6c1;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #ff0084;
}

.form-group small {
    display: block;
    margin-top: 3px;
    color: #ff69b4;
    font-size: 0.8rem;
}

button {
    background: linear-gradient(135deg, #ff69b4 0%, #ff0084 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    border: 2px solid white;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,105,180,0.5);
}

button:active {
    transform: translateY(0);
}

.price-display button {
    width: auto;
    padding: 6px 14px;
    font-size: 0.85rem;
}

.result {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ff69b4;
    background: rgba(255, 255, 255, 0.7);
}

.result h4 {
    margin-bottom: 8px;
    font-size: 1.1rem;
    color: #ff0084;
}

.result p {
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.result .highlight {
    font-weight: bold;
    font-size: 1rem;
    color: #ff0084;
}

@media (max-width: 768px) {
    .calculator-section {
        grid-template-columns: 1fr;
    }
    
    .calculator-card {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
}

/* Loading Spinners */
.spinner {
    border: 4px solid rgba(255, 105, 180, 0.3);
    border-left: 4px solid #ff69b4;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

.spinner-small {
    border: 2px solid rgba(255, 105, 180, 0.3);
    border-left: 2px solid #ff69b4;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    text-align: center;
    padding: 20px;
    color: #ff0084;
}

.loading p {
    margin: 0;
    font-weight: 500;
}

.price-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #666;
}

/* Button loading states */
button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
}

button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Result states */
.result.success {
    border-left-color: #28a745;
    background: rgba(212, 237, 218, 0.8);
}

.result.error {
    border-left-color: #dc3545;
    background: rgba(248, 215, 218, 0.8);
}

.result.good-deal {
    border-left-color: #17a2b8;
    background: rgba(209, 236, 241, 0.8);
}

.result.bad-deal {
    border-left-color: #dc3545;
    background: rgba(248, 215, 218, 0.8);
}

/* Buy Me A Coffee Button Styling */
#bmc-button {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 999 !important;
    opacity: 0.75;
    transition: opacity 0.3s ease;
    display: block !important;
}

#bmc-button img {
    height: 30px !important;
    width: auto !important;
    max-width: 110px !important;
}

#bmc-button:hover {
    opacity: 1;
}

/* Ensure button doesn't interfere with mobile layout */
@media (max-width: 768px) {
    #bmc-button {
        bottom: 15px !important;
        right: 15px !important;
    }
    
    #bmc-button img {
        height: 25px !important;
        width: auto !important;
        max-width: 90px !important;
    }
}

/* ── Bid Ceiling ────────────────────────────────────────────────────────────── */

.bid-ceiling-section {
    margin-bottom: 20px;
}

.bid-ceiling-card {
    border: 3px solid #ff0084;
    box-shadow: 0 8px 30px rgba(255, 0, 132, 0.25);
}

.bid-ceiling-bottom-row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.bid-ceiling-bottom-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.bid-ceiling-result {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 20px 0 10px;
    padding: 16px;
    background: rgba(255, 0, 132, 0.06);
    border-radius: 10px;
    border: 2px solid #ff69b4;
}

.bid-ceiling-main {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.bid-melt-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.bid-melt-label {
    font-size: 1rem;
    color: #ff69b4;
    font-weight: 600;
}

.bid-melt-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #888;
}

.bid-ceiling-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ff69b4;
    white-space: nowrap;
}

.bid-ceiling-value {
    font-size: 3rem;
    font-weight: 800;
    color: #ccc;
    line-height: 1;
    transition: color 0.2s;
}

.bid-ceiling-value-ready {
    color: #ff0084;
}

.bid-ceiling-actions {
    margin-bottom: 12px;
}

.bid-ceiling-actions button {
    width: auto;
    padding: 8px 20px;
    background: white;
    color: #ff0084;
    border: 2px solid #ff69b4;
}

.bid-ceiling-actions button:hover {
    background: rgba(255, 0, 132, 0.06);
    border-color: #ff0084;
}

.bid-margin-explainer {
    margin-top: 4px;
    border-top: 1px dashed #ffb6c1;
    padding-top: 8px;
}

.bid-margin-explainer summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: #ff69b4;
    font-weight: 600;
    user-select: none;
}

.bid-margin-explainer summary:hover {
    color: #ff0084;
}

.bid-margin-explainer-content {
    margin-top: 10px;
    font-size: 0.88rem;
    color: #555;
    line-height: 1.6;
}

.bid-margin-explainer-content p {
    margin-bottom: 6px;
}

@media (max-width: 480px) {
    .bid-ceiling-bottom-row {
        flex-direction: column;
        gap: 0;
    }

    .bid-ceiling-bottom-row .form-group {
        margin-bottom: 12px;
    }

    .bid-ceiling-value {
        font-size: 2.2rem;
    }
}

/* ── Gold % Purity Toggle ─────────────────────────────────────────────────── */

.gold-pct-toggle {
    margin-top: 12px;
    border-top: 1px dashed #ffb6c1;
    padding-top: 8px;
}

.gold-pct-toggle summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: #ff69b4;
    font-weight: 600;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gold-pct-toggle summary::-webkit-details-marker { display: none; }

.gold-pct-toggle summary::before {
    content: '+';
    font-size: 1rem;
    font-weight: 700;
    color: #ff69b4;
    transition: transform 0.15s;
    display: inline-block;
    width: 14px;
}

.gold-pct-toggle[open] summary::before {
    transform: rotate(45deg);
}

.gold-pct-toggle summary:hover {
    color: #ff0084;
}

.gold-pct-content {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(255, 105, 180, 0.05);
    border-radius: 8px;
    border: 1px solid #ffb6c1;
}

.gold-pct-content label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ff0084;
    margin-bottom: 6px;
}

.gold-pct-content input[type="range"] {
    width: 100%;
    accent-color: #ff0084;
    margin-bottom: 4px;
}

.gold-pct-content small {
    color: #ff69b4;
    font-size: 0.8rem;
}

/* ── Quick-Tap Karat Buttons ─────────────────────────────────────────────────── */

.karat-btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.karat-tap-btn {
    flex: 1;
    min-width: 44px;
    padding: 10px 4px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 8px;
    border: 2px solid #ffb6c1;
    background: white;
    color: #ff0084;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    width: auto;
}

.karat-tap-btn:hover {
    border-color: #ff0084;
    background: rgba(255, 0, 132, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 105, 180, 0.3);
}

.karat-tap-active {
    background: linear-gradient(135deg, #ff69b4 0%, #ff0084 100%) !important;
    border-color: #ff0084 !important;
    color: white !important;
    box-shadow: 0 3px 10px rgba(255, 0, 132, 0.4);
}

.karat-tap-active:hover {
    transform: translateY(-1px);
}

/* ── Karat Breakdown Table ──────────────────────────────────────────────────── */

.karat-breakdown-section {
    margin-top: 20px;
}

.breakdown-inputs {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.breakdown-inputs .form-group {
    flex: 1;
    margin-bottom: 0;
}

.breakdown-placeholder {
    color: #ff69b4;
    font-style: italic;
    text-align: center;
    padding: 15px 0;
    margin: 0;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.karat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.karat-table th {
    background: linear-gradient(135deg, #ff69b4 0%, #ff0084 100%);
    color: white;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.karat-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #ffb6c1;
    white-space: nowrap;
}

.karat-table tbody tr:hover {
    background: rgba(255, 105, 180, 0.08);
}

.karat-highlight {
    background: rgba(255, 0, 132, 0.06);
}

.karat-highlight td {
    color: #ff0084;
    font-weight: 600;
}

.copy-btn {
    width: auto;
    padding: 3px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 5px;
    min-width: 52px;
}

@media (max-width: 480px) {
    .breakdown-inputs {
        flex-direction: column;
        gap: 0;
    }

    .breakdown-inputs .form-group {
        margin-bottom: 15px;
    }

    .karat-table {
        font-size: 0.85rem;
    }

    .karat-table th,
    .karat-table td {
        padding: 6px 8px;
    }
}
