/* Mantine-inspired Color Scheme for Rengaslaskuri */

:root {
    /* Dark Mode - Mantine Gray with Blue Accent */
    --bg-primary: #16171b;
    --bg-secondary: #25262b;
    --bg-tertiary: #2c2e33;
    --text-primary: #e0e0e0;
    --text-secondary: #a6a6a6;
    --border-color: #495057;
    --accent: #4c6ef5;
    --accent-hover: #3c5ce6;
}

@media (prefers-color-scheme: light) {
    :root {
        /* Light Mode */
        --bg-primary: #ffffff;
        --bg-secondary: #f8f9fa;
        --bg-tertiary: #f1f3f5;
        --text-primary: #212529;
        --text-secondary: #495057;
        --border-color: #dee2e6;
        --accent: #6c757d;
        --accent-hover: #5a6268;
    }
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

/* Main container */
.tire-comparison-form {
    width: 1000px;
    max-width: 100%;
    margin: 40px auto;
    padding: 0 16px;
}

.tire-comparison-form h2 {
    margin: 0 0 24px 0;
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.5px;
}

/* Form container */
.tire-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.3s ease;
}

.tire-columns {
    display: flex;
    gap: 24px;
    flex: 1 1 auto;
    align-items: flex-start;
}

.tire-column {
    flex: 1 1 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s ease;
}

.tire-column h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 600;
}

.tire-size-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    overflow: visible;
}

.tire-size-row label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

select, input[type="number"] {
    padding: 10px 12px;
    border-radius: 6px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease;
}

select:hover, input[type="number"]:hover {
    border-color: var(--accent);
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.1);
}

select {
    min-width: 64px;
    width: auto;
    display: inline-block;
    flex: 0 0 auto;
    cursor: pointer;
}

.tire-size-row span {
    margin: 0 4px;
    color: var(--text-secondary);
    flex: 0 0 auto;
    font-weight: 500;
}

.tire-size-row label { margin-right: 4px; }

.inch-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.inch-row input, .inch-row select {
    width: 72px;
    min-width: 56px;
}

@media (max-width:800px) {
    .inch-row input, .inch-row select { width:64px; }
}

/* Mode selection */
.mode-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.mode-row .mode-option {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.mode-row input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-row .mode-option span {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mode-row input[type="radio"]:checked + span {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
}

.mode-row .mode-option span:hover {
    border-color: var(--accent);
    background: var(--bg-tertiary);
}

.actions {
    padding: 14px 0 0 0;
    display: flex;
    gap: 12px;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    padding: 14px 18px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--accent);
    color: #ffffff;
    padding: 14px 18px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex: 1;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-browse {
    background: var(--accent);
    color: #ffffff;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.btn-browse:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.btn-browse:active {
    transform: translateY(0);
}

.btn-browse i {
    font-size: 16px;
}

.btn-browse-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    flex-shrink: 0;
}

.tire-results {
    margin-top: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    min-height: 110px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 8px;
    transition: all 0.3s ease;
}

/* Comparison results */
.comparison-results {
    margin: 20px 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.comparison-summary {
    width: 100%;
}

.result-line {
    margin: 0;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.increase { }
.decrease { }

/* Severity colors for change magnitude - these override increase/decrease */
.small { color: #10b981; font-weight: 600; } /* ≤ ±3% - Green - OK */
.medium { color: #f59e0b; font-weight: 600; } /* ±3-5% - Yellow/Orange - Warning */
.large { color: #ef4444; font-weight: 600; } /* > ±5% - Red - Warning */

/* Footer - Inline Dropdown Style */
.mcr-footer {
    margin-top: 8px;
    padding: 0;
    border: none;
    background: transparent;
}

.mcr-footer-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 13px;
}

.mcr-footer-toggle:hover {
    background: var(--accent-hover);
    border-color: var(--accent);
}

.mcr-footer-toggle-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.mcr-footer-toggle.expanded .mcr-footer-toggle-icon {
    transform: rotate(180deg);
}

.mcr-footer-toggle-text {
    font-weight: 500;
    color: var(--text-primary);
}

.mcr-footer-content {
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 0;
    padding: 0;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 12px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.mcr-footer.expanded .mcr-footer-content {
    max-height: 400px;
    margin-top: 12px;
    padding: 12px;
    border-color: var(--border-color);
    opacity: 1;
    visibility: visible;
}

.mcr-footer-section h4 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mcr-footer-section p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.mcr-footer-section a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.mcr-footer-section a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.mcr-footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mcr-footer-section li {
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

.mcr-footer-section li:last-child {
    margin-bottom: 0;
}

.mcr-footer-bottom {
    text-align: center;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    margin-top: 10px;
}

@media (max-width: 1100px) {
    .tire-comparison-form { width: 100%; }
    .tire-columns { flex-direction: column; }
}

@media (max-width: 600px) {
    .tire-comparison-form h2 {
        font-size: 24px;
        margin-bottom: 18px;
    }

    .tire-form {
        padding: 16px;
    }

    .tire-columns {
        gap: 16px;
    }

    .tire-column {
        padding: 14px;
    }

    .actions {
        flex-direction: column;
    }

    .btn-secondary {
        flex: 1 1 100%;
    }

    .tire-results {
        min-height: auto;
    }

    .mcr-footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .tire-size-row select, .tire-size-row input { max-width: 100%; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Selection color */
::selection {
    background: rgba(11, 118, 239, 0.3);
    color: #f1f5f9;
}