/* TAG Score Calculator - Custom Styles */

/* Score Display Card Animation */
@keyframes scoreReveal {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#results-section {
    animation: scoreReveal 0.5s ease-out;
}

/* Calculate Button Pulse on Hover */
#calculate-btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#calculate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(192, 160, 98, 0.3);
}

#calculate-btn:active:not(:disabled) {
    transform: translateY(0);
}

#calculate-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Loading Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Score Gauge Visual */
.score-gauge {
    position: relative;
    height: 8px;
    background: linear-gradient(
        to right,
        #ef4444 0%,      /* Poor */
        #f59e0b 20%,     /* Fair */
        #eab308 35%,     /* Good */
        #84cc16 50%,     /* VG-EX */
        #22c55e 65%,     /* Excellent */
        #06b6d4 78%,     /* Near Mint */
        #8b5cf6 88%,     /* Mint */
        #c0a062 95%,     /* Gem Mint */
        #fbbf24 100%     /* Pristine */
    );
    border-radius: 999px;
    overflow: hidden;
}

.score-indicator {
    position: absolute;
    top: -4px;
    width: 16px;
    height: 16px;
    background: white;
    border: 3px solid #c0a062;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: left 0.5s ease-out;
}

/* Breakdown Cards Hover Effect */
.breakdown-card {
    transition: all 0.3s ease;
}

.breakdown-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Adjustments */
.dark .breakdown-card:hover {
    box-shadow: 0 8px 16px rgba(192, 160, 98, 0.2);
}

/* Metric Display */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .metric-row {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

.metric-row:last-child {
    border-bottom: none;
}

.metric-label {
    font-weight: 500;
    color: #6b7280;
}

.dark .metric-label {
    color: #9ca3af;
}

.metric-value {
    font-weight: 600;
    color: #111827;
}

.dark .metric-value {
    color: #f3f4f6;
}

.metric-value.perfect {
    color: #22c55e;
}

.metric-value.good {
    color: #3b82f6;
}

.metric-value.warning {
    color: #f59e0b;
}

.metric-value.poor {
    color: #ef4444;
}

/* Centering Visualization */
.centering-visual {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(192, 160, 98, 0.1);
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.dark .centering-visual {
    background: rgba(192, 160, 98, 0.2);
}

/* Grade Badge */
.grade-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
}

.grade-badge.pristine {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
}

.grade-badge.gem-mint {
    background: linear-gradient(135deg, #c0a062 0%, #a78b4a 100%);
    color: white;
}

.grade-badge.mint {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.grade-badge.nm-mt {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: white;
}

/* Calculation Steps */
.calculation-step {
    display: flex;
    align-items: start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(59, 130, 246, 0.05);
    border-left: 3px solid #3b82f6;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.dark .calculation-step {
    background: rgba(59, 130, 246, 0.1);
}

.calculation-step-number {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
}

/* Input Focus Enhancement */
#dig-report-url:focus {
    box-shadow: 0 0 0 3px rgba(192, 160, 98, 0.2);
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .modular-typo.hero .big {
        font-size: 2.5rem;
    }
    
    .modular-typo.hero .sub {
        font-size: 1.25rem;
    }
    
    #calculated-score {
        font-size: 4rem;
    }
    
    #calculated-grade {
        font-size: 1.5rem;
    }
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #1a1a1a;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    line-height: 1.4;
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1a1a1a transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Stat Bars */
.stat-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.dark .stat-bar {
    background: #44434e;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease-out;
}

.stat-bar-fill.perfect {
    background: linear-gradient(90deg, #22c55e 0%, #10b981 100%);
}

.stat-bar-fill.good {
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
}

.stat-bar-fill.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.stat-bar-fill.poor {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.dark .empty-state {
    color: #6b7280;
}

/* Print Styles */
@media print {
    header, .modular-typo, #dig-report-url, #calculate-btn {
        display: none;
    }
    
    #results-section {
        display: block !important;
    }
    
    * {
        background: white !important;
        color: black !important;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible for Keyboard Navigation */
*:focus-visible {
    outline: 2px solid #c0a062;
    outline-offset: 2px;
}

/* Button Loading State */
#calculate-btn.loading {
    pointer-events: none;
}

#calculate-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
