/* ─── Base ─── */
a.navbar-brand { white-space: normal; text-align: center; word-break: break-all; }
a { color: #0366d6; }
.btn-primary { color: #fff; background-color: #1b6ec2; border-color: #1861ac; }

html { font-size: 14px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }
.border-top { border-top: 1px solid #e5e5e5; }
.border-bottom { border-bottom: 1px solid #e5e5e5; }
.box-shadow { box-shadow: 0 .25rem .75rem rgba(0,0,0,.05); }

/* ─── Calculator Container ─── */
.calc-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* ─── Calculator Header ─── */
.calc-header {
    background: linear-gradient(135deg, #e13131, #bb4741);
    color: white;
    padding: 3rem 0;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}
.calc-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    pointer-events: none;
}
.calc-header .header-content { position: relative; z-index: 2; }
.calc-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: -0.02em;
}
@media (max-width: 768px) {
    .calc-header { padding: 2rem 0; border-radius: 15px; }
    .calc-header h1 { font-size: 2rem; }
}
@media (max-width: 576px) { .calc-header h1 { font-size: 1.75rem; } }

/* ─── Calculator Section ─── */
.calculator-section, .content-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}
.content-section { margin-bottom: 30px; }
.content-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
    border-bottom: 3px solid #4facfe;
    padding-bottom: 10px;
}
.content-section h3 {
    color: #2d3748;
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding: 10px 15px;
    background: linear-gradient(90deg, #f0f4ff, transparent);
    border-left: 4px solid #667eea;
    border-radius: 0 8px 8px 0;
}
.content-section ul {
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px 20px 20px 40px;
    border: 1px solid #e2e8f0;
}
.content-section ul li {
    margin-bottom: 10px;
    line-height: 1.7;
}
.content-section ul li:last-child { margin-bottom: 0; }
.content-section p code {
    background: #eef2ff;
    color: #4338ca;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.95em;
    font-weight: 600;
}

/* ─── Formula highlight ─── */
.formula-highlight {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    padding: 15px 20px;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    font-size: 1.05rem;
    font-weight: 600;
    color: #3730a3;
    text-align: center;
    letter-spacing: 0.5px;
}

/* ─── Example boxes ─── */
.example-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 18px 20px;
    margin: 15px 0;
}
.example-box strong:first-child {
    color: #92400e;
}

/* ─── FAQ items ─── */
.faq-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}
.faq-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102,126,234,0.1);
}
.faq-item strong {
    color: #1e293b;
    display: block;
    margin-bottom: 6px;
    font-size: 1.05rem;
}

/* ─── Info callout ─── */
.info-callout {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
    border-radius: 10px;
    padding: 18px 20px;
    margin: 15px 0;
}
.main-content { padding: 40px; }

/* ─── Form Elements ─── */
.cal-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}
@media (max-width: 768px) {
    .cal-label { font-size: 20px !important; font-weight: 600 !important; margin-bottom: 12px !important; }
}

.cal-input-group {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
    height: 50px;
}
@media (max-width: 768px) {
    .cal-input-group { height: 50px !important; font-size: 18px !important; padding: 12px 16px !important; }
}

input::placeholder { color: black; font-weight: bold; font-size: 16px; font-style: italic; }

.calculate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}
.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102,126,234,0.4);
}
@media (max-width: 768px) {
    .calculate-btn { font-size: 25px !important; margin-top: 25px !important; padding: 15px !important; }
}

/* ─── Results ─── */
.result-error {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    display: none;
    animation: slideIn 0.5s ease;
}

.error-modern {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(255,107,107,0.3);
    animation: slideInError 0.3s ease;
}
.error-modern::before { content: "⚠️"; margin-right: 8px; font-size: 16px; }

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

.notification-success {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    animation: slideInSuccess 0.4s ease;
}
@keyframes slideInSuccess {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cal-completed::placeholder { color: green; opacity: 1; font-weight: bold !important; }
.cal-completed { border: 2px solid green; background: #d9f9d9; }
.cal-normal::placeholder { opacity: 0.8; font-weight: 400 !important; }

/* ─── Tutorial Cards ─── */
.tuto-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 0 auto;
    margin-bottom: 30px;
}
.tuto-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.tuto-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}
.tuto-header { display: flex; align-items: center; margin-bottom: 25px; }
.tuto-icon {
    background: linear-gradient(135deg, #667eea, #764ba2);
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-right: 15px;
    font-size: 1.5rem;
    color: white;
}
.tuto-title { color: #2d3748; font-size: 1.4rem; font-weight: 700; margin: 0; }
.instruction-label {
    display: flex; align-items: center;
    color: #4a5568; font-weight: 600;
    margin-bottom: 12px; font-size: 0.95rem;
}
.instruction-label i { margin-right: 8px; color: #48bb78; }
.field-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.field-tag {
    background: linear-gradient(135deg, #e6fffa, #c6f6d5);
    color: #2f855a;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #9ae6b4;
}
.empty-field-tag {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    color: #c53030;
    border: 1px solid #fc8181;
}
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #e2e8f0, transparent);
    margin: 20px 0;
}

/* ─── Calculator Grid (homepage) ─── */
.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}
.calculator-item {
    background: white;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: block;
}
.calculator-item:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    text-decoration: none;
    color: inherit;
}

/* ─── Homepage Hero ─── */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 2rem;
}
.hero-section h1 { font-weight: 700; }
.hero-section .badge { font-size: 0.9rem; }

/* ─── Stats ─── */
.stats-section {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    padding: 3rem 0;
}
.stat-number { font-size: 2.5rem; font-weight: 700; color: #667eea; }

/* ─── Feature Cards ─── */
.feature-card {
    border: none;
    border-radius: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}
.category-icon {
    width: 80px; height: 80px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
}
.geometry-icon { background: #fee2e2; color: #dc2626; }
.physics-icon  { background: #fef3c7; color: #d97706; }
.math-icon     { background: #dbeafe; color: #2563eb; }

/* ─── Formula Image ─── */
.formula-img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* ─── Other Calculators Section ─── */
.other-calculators {
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
}
.other-calculators h3 {
    color: #1e293b;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}
.other-calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.other-calc-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: #334155;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}
.other-calc-link:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102,126,234,0.15);
    transform: translateY(-2px);
    text-decoration: none;
    color: #667eea;
}
.other-calc-link i {
    margin-right: 10px;
    color: #667eea;
    font-size: 1.1rem;
}

/* ─── Legal Pages ─── */
.legal-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}
.legal-page h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}
.legal-page .legal-date {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 30px;
}
.legal-page h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #334155;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}
.legal-page p, .legal-page li {
    color: #475569;
    line-height: 1.8;
}
.legal-page ul {
    padding-left: 25px;
}
.legal-page ul li {
    margin-bottom: 8px;
}

/* ─── Footer ─── */
.site-footer {
    border-top: 1px solid #e5e5e5;
    background: #f8f9fa;
    margin-top: 3rem;
    font-weight: bold;
}
.site-footer .footer-links a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.2s;
}
.site-footer .footer-links a:hover {
    color: #667eea;
}
