/* CalWhat Calculator Platform - DilutionCalculator CSS
 * This file contains calculator-specific styles only.
 * DO NOT redefine global classes from layout.css
 * (e.g., .glass-card, .form-input, .btn-custom, .btn-sponsor, etc.)
 */

/* ===== Tab Navigation ===== */
.tab-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.tab-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.tab-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tab-btn .tab-title {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.tab-btn .tab-desc {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
}

.tab-btn.active .tab-desc {
    color: rgba(255, 255, 255, 0.9);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Preset Buttons ===== */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.preset-btn:hover {
    border-color: #48bb78;
    background: rgba(72, 187, 120, 0.05);
    transform: translateY(-2px);
}

.preset-btn i {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 5px;
}

.preset-btn .preset-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2d3748;
    margin-bottom: 2px;
}

.preset-btn .preset-desc {
    font-size: 0.75rem;
    color: #718096;
}

/* ===== Input Group (Calculator Specific) ===== */
.input-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.input-group-custom {
    display: flex;
    flex-direction: column;
}

.input-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.input-label i {
    color: #667eea;
}

.input-wrapper {
    position: relative;
}

.input-with-unit {
    display: flex;
    gap: 8px;
}

.input-with-unit .form-input {
    flex: 1;
}

.unit-select {
    width: 70px;
    padding: 10px 8px;
    border: 2px solid #48bb78;
    border-radius: 12px;
    font-family: 'Roboto Mono', monospace;
    background: white;
    cursor: pointer;
}

/* ===== Contraction Toggle ===== */
.contraction-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    margin-top: 15px;
}

.contraction-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
}

.contraction-toggle label {
    flex: 1;
    cursor: pointer;
}

.contraction-toggle .toggle-title {
    font-weight: 600;
    color: #2d3748;
    display: block;
}

.contraction-toggle .toggle-desc {
    font-size: 0.8rem;
    color: #718096;
}

/* ===== Result Card ===== */
.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.result-main {
    text-align: center;
    padding: 20px 0;
}

.result-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    margin-bottom: 10px;
}

.result-value.large {
    font-size: 3rem;
}

.result-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin: 15px 0;
}

.result-details {
    margin-top: 15px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-item:last-child {
    border-bottom: none;
}

.result-item-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

.result-item-value {
    font-weight: 600;
    font-family: 'Roboto Mono', monospace;
}

.result-ratio {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 10px;
}

.result-ratio-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
}

/* ===== Chart Container ===== */
.chart-container {
    position: relative;
    height: 250px;
    margin: 15px 0;
}

/* ===== Preparation Steps ===== */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.step-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
}

.step-item:last-child {
    border-bottom: none;
}

.step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 3px;
}

.step-desc {
    font-size: 0.9rem;
    color: #718096;
}

.step-highlight {
    color: #667eea;
    font-weight: 600;
}

/* ===== Safety Warnings ===== */
.safety-section {
    margin-top: 15px;
}

.safety-item {
    display: flex;
    gap: 12px;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.safety-item:last-child {
    margin-bottom: 0;
}

.safety-item.warning-acid {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}

.safety-item.warning-alkali {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
}

.safety-item.warning-alcohol {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.safety-item.warning-bleach {
    background: #f3e8ff;
    border-left: 4px solid #a855f7;
}

.safety-item.warning-general {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
}

.safety-item i {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.safety-item.warning-acid i { color: #f59e0b; }
.safety-item.warning-alkali i { color: #3b82f6; }
.safety-item.warning-alcohol i { color: #ef4444; }
.safety-item.warning-bleach i { color: #a855f7; }
.safety-item.warning-general i { color: #22c55e; }

.safety-content {
    flex: 1;
}

.safety-title {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 3px;
}

.safety-text {
    color: #4a5568;
    line-height: 1.5;
}

/* ===== Density Table ===== */
.density-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 10px;
}

.density-table th,
.density-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.density-table th {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-weight: 600;
}

.density-table tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

.density-note {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 10px;
    font-style: italic;
}

/* ===== Error State ===== */
.input-error {
    border-color: #ef4444 !important;
}

.error-message {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.error-message i {
    font-size: 0.9rem;
}

/* ===== Tooltip ===== */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #e2e8f0;
    border-radius: 50%;
    font-size: 0.7rem;
    color: #718096;
    cursor: help;
    position: relative;
}

.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 400;
    white-space: nowrap;
    z-index: 100;
    transition: all 0.3s ease;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2d3748;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .tab-nav {
        flex-direction: column;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .result-value {
        font-size: 2rem;
    }

    .result-value.large {
        font-size: 2.5rem;
    }

    .chart-container {
        height: 200px;
    }

    .step-item {
        flex-direction: column;
        gap: 10px;
    }

    .density-table {
        font-size: 0.8rem;
    }

    .density-table th,
    .density-table td {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    .preset-grid {
        grid-template-columns: 1fr;
    }

    .preset-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        text-align: left;
    }

    .preset-btn i {
        margin-bottom: 0;
    }
}
