/* SoVael Tools — Clean, minimal utility theme */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 40px 0;
    text-align: center;
}
.header h1 { font-size: 2.2rem; font-weight: 700; margin-bottom: 8px; }
.subtitle { font-size: 1.1rem; opacity: 0.9; }

/* Card Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    padding: 48px 0;
}
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s;
    display: block;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.card-icon { font-size: 2rem; margin-bottom: 12px; }
.card h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; }

/* Tool Pages */
.tool-page { padding: 32px 0; flex: 1; }
.tool-page h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 24px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; color: var(--text); }
.form-group input, .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.15s;
    background: white;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary {
    background: var(--border);
    color: var(--text);
}
.btn-secondary:hover { background: #cbd5e1; }
.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: #15803d; }

/* Results */
.result-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 20px;
    display: none;
}
.result-box.visible { display: block; }
.result-box h3 { font-size: 1.1rem; margin-bottom: 12px; color: var(--primary); }
.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0f2fe;
}
.result-item:last-child { border-bottom: none; }
.result-item .label { font-weight: 500; }
.result-item .value { font-weight: 700; color: var(--primary-dark); }
.result-item .value.positive { color: var(--success); }
.result-item .value.negative { color: var(--danger); }

/* Table (invoice) */
.table-wrap { overflow-x: auto; }
.invoice-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.invoice-table th {
    background: #f1f5f9;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
}
.invoice-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.invoice-table input { width: 100%; border: 1px solid var(--border); padding: 6px 10px; border-radius: 6px; font-size: 0.9rem; }
.invoice-table .remove-btn {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.85rem;
}
.invoice-table .remove-btn:hover { background: #fef2f2; }

.invoice-totals { text-align: right; margin-top: 16px; }
.invoice-totals p { padding: 4px 0; font-size: 1rem; }
.invoice-totals .grand-total { font-size: 1.3rem; font-weight: 700; color: var(--primary); }

.invoice-header-fields {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

/* Converter */
.converter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.converter-row input { flex: 1; }
.converter-row select { flex: 1; }
.swap-btn {
    background: var(--border);
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.15s;
}
.swap-btn:hover { background: #cbd5e1; }

.category-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 16px;
    background: white;
}

/* BMI */
.bmi-scale {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
    height: 24px;
}
.bmi-scale div {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}
.bmi-underweight { background: #93c5fd; }
.bmi-normal { background: #22c55e; }
.bmi-overweight { background: #eab308; }
.bmi-obese { background: #ef4444; }

.bmi-indicator {
    width: 20px;
    height: 20px;
    background: var(--text);
    border-radius: 50%;
    position: relative;
    margin: 4px auto 0;
    transition: margin-left 0.3s;
}

/* Footer */
.footer {
    background: #1e293b;
    color: #94a3b8;
    padding: 24px 0;
    text-align: center;
    margin-top: auto;
}
.footer nav { margin-bottom: 8px; }
.footer nav a { color: #94a3b8; text-decoration: none; margin: 0 12px; font-size: 0.9rem; }
.footer nav a:hover { color: white; }

/* Utility */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }

/* Back link */
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
    .grid { grid-template-columns: 1fr; }
    .header h1 { font-size: 1.6rem; }
}
