/**
 * Buy vs 3D Print Cost Calculator Styles
 * 
 * Purpose: Ultra-compact, mobile-first styling for cost comparison calculator
 * Features: Minimal spacing, optimized for mobile, responsive design
 */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #2563eb;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --border-radius: 0.25rem;
    --shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.4;
    color: var(--text-primary);
    background-color: var(--background-color);
    font-size: 13px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.5rem;
}

/* Header styles */
header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.125rem;
}

header p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Calculator grid layout */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Input sections */
.input-section {
    background: var(--card-background);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.input-section h2 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.125rem;
}

.input-group {
    margin-bottom: 0.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.125rem;
    font-weight: 500;
    font-size: 0.625rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.input-group input {
    width: 100%;
    padding: 0.375rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 40px;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* Calculated info display */
.calculated-info {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: var(--background-color);
    border-radius: var(--border-radius);
    border-left: 2px solid var(--secondary-color);
}

.calculated-info p {
    margin-bottom: 0.125rem;
    font-weight: 500;
    font-size: 0.625rem;
}

.calculated-info span {
    color: var(--primary-color);
    font-weight: 600;
}

/* Results section */
.results-section {
    background: var(--card-background);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
}

.results-section h2 {
    text-align: center;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-card {
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 65px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.result-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.result-card.winner {
    border-color: var(--secondary-color);
    background-color: rgba(16, 185, 129, 0.05);
}

.result-card.loser {
    border-color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.05);
}

.result-card h3 {
    margin-bottom: 0.125rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.result-card .cost {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
}

.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    margin: 0 auto;
}

/* Winner announcement */
.winner {
    text-align: center;
    padding: 0.5rem;
    background: linear-gradient(135deg, var(--secondary-color), #059669);
    color: white;
    border-radius: var(--border-radius);
    margin-top: 0.375rem;
}

.winner h3 {
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.winner p {
    font-size: 0.75rem;
}

/* Share button */
.share-button {
    margin-top: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    font-size: 0.625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.share-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.share-button:active {
    transform: translateY(0);
    background: rgba(255, 255, 255, 0.1);
}

/* Info section */
.info-section {
    background: var(--card-background);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.info-section h2 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.info-card {
    padding: 0.5rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border-left: 2px solid var(--accent-color);
}

.info-card h4 {
    margin-bottom: 0.375rem;
    color: var(--primary-color);
    font-size: 0.75rem;
}

.info-card p {
    margin-bottom: 0.125rem;
    font-size: 0.625rem;
}

.info-card span {
    font-weight: 600;
    color: var(--primary-color);
}

.info-card small {
    color: var(--text-secondary);
    font-style: italic;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.625rem;
}

/* Mobile-first responsive design */
@media (max-width: 640px) {
    body {
        font-size: 12px;
    }
    
    .container {
        padding: 0.25rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    header p {
        font-size: 0.7rem;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: 0.375rem;
        margin-bottom: 0.75rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }
    
    .vs-divider {
        order: -1;
        margin-bottom: 0.375rem;
        width: 28px;
        height: 28px;
        font-size: 0.625rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.375rem;
    }
    
    .input-section,
    .results-section,
    .info-section {
        padding: 0.5rem;
    }
    
    .result-card {
        min-height: 55px;
        padding: 0.375rem;
    }
    
    .result-card .cost {
        font-size: 1rem;
    }
    
    .winner h3 {
        font-size: 0.75rem;
    }
    
    .winner p {
        font-size: 0.7rem;
    }
    
    .share-button {
        min-height: 32px;
        font-size: 0.6rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.125rem;
    }
    
    .input-section,
    .results-section,
    .info-section {
        padding: 0.375rem;
    }
    
    header h1 {
        font-size: 1.125rem;
    }
    
    .input-section h2 {
        font-size: 0.875rem;
    }
    
    .results-section h2 {
        font-size: 1rem;
    }
    
    .result-card {
        padding: 0.25rem;
        min-height: 50px;
    }
    
    .result-card .cost {
        font-size: 0.875rem;
    }
    
    .calculated-info,
    .info-card {
        padding: 0.375rem;
    }
    
    .input-group {
        margin-bottom: 0.375rem;
    }
    
    .input-group input {
        min-height: 36px;
        padding: 0.25rem;
    }
}

/* Ultra-compact landscape mode */
@media (max-width: 896px) and (orientation: landscape) {
    .container {
        padding: 0.25rem;
    }
    
    header {
        margin-bottom: 0.5rem;
    }
    
    header h1 {
        font-size: 1.125rem;
    }
    
    .calculator-grid,
    .results-section,
    .info-section {
        margin-bottom: 0.5rem;
    }
    
    .input-section,
    .results-section,
    .info-section {
        padding: 0.5rem;
    }
}

/* Animation for updated values */
@keyframes valueUpdate {
    0% { background-color: rgba(37, 99, 235, 0.1); }
    100% { background-color: transparent; }
}

.value-updated {
    animation: valueUpdate 0.3s ease-out;
}

/* Improved touch targets for mobile */
@media (pointer: coarse) {
    .input-group input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .result-card {
        min-height: 60px;
    }
    
    .share-button {
        min-height: 40px;
    }
} 