/* ===== LIQUID FILLING SPEED CALCULATOR STYLES ===== */

/* Root Variables */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --accent-color: #f59e0b;
    --accent-hover: #d97706;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --liquid-primary: #06b6d4;
    --liquid-secondary: #67e8f9;
    --liquid-accent: #a7f3d0;
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-light: #f9fafb;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-muted: #f1f5f9;
    --bg-dark: #1f2937;
    
    --border-color: #e5e7eb;
    --border-focus: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    --transition: all 0.3s ease;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.6;
    color: #6b7280;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header Styles */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 40;
}

.header nav {
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.logo:hover {
    color: var(--primary-hover);
}

.logo svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Flexbox utilities */
.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.items-center {
    align-items: center;
}

.space-x-6 > * + * {
    margin-left: 1.5rem;
}

.space-x-1 > * + * {
    margin-left: 0.25rem;
}

.space-x-3 > * + * {
    margin-left: 0.75rem;
}

.hidden {
    display: none;
}

@media (min-width: 768px) {
    .md\:flex {
        display: flex;
    }
    
    .md\:space-x-3 > * + * {
        margin-left: 0.75rem;
    }
    
    .md\:hidden {
        display: none;
    }
}

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--liquid-primary);
}

.text-sm {
    font-size: 0.875rem;
}

.text-gray-500 {
    color: #6b7280;
}

.hover\:text-blue-600:hover {
    color: #2563eb;
}

.transition-colors {
    transition: color 0.3s ease;
}

.text-blue-600 {
    color: #2563eb;
}

.font-medium {
    font-weight: 500;
}

.w-4 {
    width: 1rem;
}

.h-4 {
    height: 1rem;
}

.mx-1 {
    margin-left: 0.25rem;
    margin-right: 0.25rem;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--liquid-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 48rem;
    margin: 0 auto;
    line-height: 1.7;
}

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

.stat-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--liquid-primary), var(--primary-color));
}

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

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--liquid-primary);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Card Styles */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title svg {
    width: 24px;
    height: 24px;
    color: var(--liquid-primary);
}

.card-content {
    padding: 1.5rem;
}

/* Tabs Container */
.tabs-container {
    width: 100%;
}

.tabs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    background: var(--bg-muted);
    padding: 0.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
}

.tab-trigger {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.tab-trigger:hover:not(.active) {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tab-trigger.active {
    background: var(--bg-primary);
    color: var(--liquid-primary);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.input, .select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--bg-primary);
}

.input:focus, .select:focus {
    outline: none;
    border-color: var(--liquid-primary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.input:hover, .select:hover {
    border-color: var(--text-secondary);
}

.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-muted);
    outline: none;
    -webkit-appearance: none;
}

.range-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--liquid-primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.range-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--liquid-primary);
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-sm);
}

.range-value {
    display: inline-block;
    margin-left: 0.5rem;
    font-weight: 500;
    color: var(--liquid-primary);
}

/* Button Styles */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--liquid-primary), var(--primary-color));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, #0891b2, var(--primary-hover));
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--bg-muted);
    border-color: var(--liquid-primary);
    color: var(--liquid-primary);
}

.calculate-section {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Results Placeholder */
.results-placeholder, .history-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.results-placeholder svg, .history-placeholder svg {
    margin: 0 auto 1rem;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.result-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    text-align: center;
}

.result-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--liquid-primary);
    margin-bottom: 0.25rem;
}

.result-unit {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Chart Grid */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .chart-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.chart-container {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    position: relative;
    height: 300px;
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.template-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--liquid-primary);
}

.template-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.template-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.template-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.template-specs {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .tabs-list {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .tab-trigger {
        min-width: auto;
    }
    
    .chart-grid {
        grid-template-columns: 1fr;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .card-content {
        padding: 1rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .hero {
        padding: 1rem 0;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
}

/* Utility classes */
.text-gray-400 {
    color: #9ca3af;
}

.w-64 {
    width: 16rem;
}

.h-64 {
    height: 16rem;
}

/* Loading states */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(6, 182, 212, 0.3);
    border-radius: 50%;
    border-top-color: var(--liquid-primary);
    animation: spin 1s ease-in-out infinite;
}

.loading::after {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    margin: 1px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--liquid-primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Accessibility Improvements */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.input:focus-visible,
.select:focus-visible,
.tab-trigger:focus-visible {
    outline: 2px solid var(--liquid-primary);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #666666;
    }

    .input, .select {
        border-width: 2px;
    }

    .btn-primary {
        background: #000000;
        border: 2px solid #000000;
    }

    .btn-secondary {
        border-width: 2px;
        border-color: #000000;
        color: #000000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .stat-card:hover,
    .template-card:hover,
    .btn-primary:hover {
        transform: none;
    }
}

/* Color Contrast Improvements */
.text-gray-400 {
    color: #6b7280; /* Improved contrast from #9ca3af */
}

.template-specs {
    color: #6b7280; /* Improved contrast from var(--text-muted) */
}

/* Navigation Buttons */
.btn-secondary {
    background: white;
    border: 1px solid #d1d5db;
    color: #374151;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary:focus {
    outline: 2px solid var(--liquid-primary);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header, .footer, .tabs-list, .btn-primary, .btn-secondary, .export-options {
        display: none;
    }

    .card {
        box-shadow: none;
        border: 1px solid #000;
        page-break-inside: avoid;
    }

    .tab-content {
        display: block !important;
    }

    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container {
        height: auto;
    }
}