/* ===================================
   RUNNING CALCULATORS - COMMON STYLES
   =================================== */

/* CSS Variables - Design System */
:root {
    /* Color Palette */
    --color-body-bg: #f9fafb;
    --color-white: #fff;
    --color-primary: #667eea;
    --color-primary-dark: #5568d3;
    --color-secondary: #764ba2;
    --color-text-main: #333;
    --color-text-secondary: #555;
    --color-text-light: #666;
    --color-text-muted: #888;
    
    /* Borders & Backgrounds */
    --color-border-light: #e0e0e0;
    --color-border-focus: #667eea;
    --color-bg-light: #f8f9fa;
    --color-bg-section: #f8f9fa;
    --color-bg-stepper: #e9ecef;
    --color-bg-stepper-hover: #dee2e6;
    --color-divider: #f3f4f6;
    
    /* Status Colors */
    --color-error: #ef4444;
    --color-success: #10b981;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-result: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Typography */
    --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-card: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ===================================
   RESET & BASE STYLES
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--gradient-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
    color: var(--color-text-main);
    line-height: 1.6;
}

/* ===================================
   CONTAINER & LAYOUT
   =================================== */

.container {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-card);
    max-width: 900px;
    width: 100%;
}

.container-compact {
    max-width: 340px;
}

.container-wide {
    max-width: 1200px;
}

/* ===================================
   TYPOGRAPHY
   =================================== */

h1 {
    color: var(--color-text-main);
    margin-bottom: var(--spacing-sm);
    font-size: 1.75rem;
    font-weight: 700;
}

h2 {
    color: var(--color-text-main);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

h3 {
    color: var(--color-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.subtitle {
    color: var(--color-text-light);
    margin-bottom: var(--spacing-lg);
    font-size: 0.875rem;
}

.helper-text {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: var(--spacing-xs);
}

/* ===================================
   INPUT SECTIONS & GROUPS
   =================================== */

.input-section {
    background: var(--color-bg-section);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.input-group {
    margin-bottom: var(--spacing-lg);
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    flex-wrap: nowrap;
}

.input-field {
    flex: 1;
    min-width: 0;
}

/* ===================================
   LABELS
   =================================== */

label {
    display: block;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===================================
   FORM INPUTS
   =================================== */

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input:invalid:not(:placeholder-shown) {
    border-color: var(--color-error);
}

select {
    cursor: pointer;
    background-color: var(--color-white);
}

/* ===================================
   STEPPER INPUT CONTROLS
   =================================== */

.input-stepper {
    display: flex;
    width: 100%;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.input-stepper:focus-within {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-stepper input {
    border: none;
    padding: var(--spacing-sm) var(--spacing-xs);
    text-align: center;
    flex-grow: 1;
    font-size: 0.875rem;
    min-width: 0;
    background: transparent;
}

.input-stepper input:focus {
    outline: none;
    box-shadow: none;
}

.input-stepper button {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-stepper);
    border: none;
    width: 28px;
    padding: 0;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    transition: background-color 0.2s ease;
}

.input-stepper button:hover {
    background: var(--color-bg-stepper-hover);
}

.input-stepper button:active {
    background: var(--color-border-light);
}

.input-stepper button:first-child {
    border-right: 1px solid var(--color-border-light);
}

.input-stepper button:last-child {
    border-left: 1px solid var(--color-border-light);
}

/* ===================================
   CHECKBOXES
   =================================== */

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-main);
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 1rem;
    height: 1rem;
}

/* ===================================
   BUTTONS
   =================================== */

.btn {
    display: inline-block;
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--gradient-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* ===================================
   RESULTS DISPLAY
   =================================== */

.result {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--gradient-result);
    border-radius: var(--radius-lg);
    color: var(--color-white);
}

.result.show {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result h2 {
    color: var(--color-white);
    margin-bottom: var(--spacing-md);
    font-size: 1.125rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-value {
    font-weight: 600;
    font-size: 1rem;
}

/* ===================================
   TABLES
   =================================== */

.table-wrapper {
    overflow-x: auto;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(102, 126, 234, 0.1);
    position: sticky;
    top: 0;
}

th {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    border-bottom: 2px solid var(--color-border-light);
}

td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: center;
    font-size: 0.875rem;
    font-family: var(--font-mono);
    border-bottom: 1px solid var(--color-divider);
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* ===================================
   DIVIDERS
   =================================== */

.divider {
    margin: var(--spacing-xl) 0;
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--color-divider);
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.input-error {
    border-color: var(--color-error);
}

.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.text-error {
    color: var(--color-error);
}

.text-success {
    color: var(--color-success);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 768px) {
    body {
        padding: var(--spacing-sm);
    }
    
    .container {
        padding: var(--spacing-lg);
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-md);
    }
    
    .input-section {
        padding: var(--spacing-md);
    }
    
    h1 {
        font-size: 1.25rem;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}