/* ============================================
   MEP CALCULATOR - GLOBAL DESIGN SYSTEM
   Version: 2.1 - Professional Color Palette
   ============================================ */

:root {
    /* Brand Colors */
    --mep-primary: #2563eb;
    --mep-primary-dark: #1d4ed8;
    --mep-primary-light: #60a5fa;
    --mep-primary-50: #eff6ff;
    --mep-primary-100: #dbeafe;
    --mep-secondary: #10b981;
    --mep-secondary-dark: #059669;
    --mep-secondary-light: #d1fae5;
    --mep-accent: #f59e0b;
    --mep-accent-dark: #d97706;
    --mep-accent-light: #fef3c7;
    /* Category Colors */
    --cat-hydraulics: #3b82f6;
    --cat-hydraulics-light: #dbeafe;
    --cat-hvac: #10b981;
    --cat-hvac-light: #d1fae5;
    --cat-sanitary: #06b6d4;
    --cat-sanitary-light: #cffafe;
    --cat-converter: #8b5cf6;
    --cat-converter-light: #ede9fe;
    /* Neutral Colors */
    --mep-bg: #f1f5f9;
    --mep-bg-dark: #e2e8f0;
    --mep-card: #ffffff;
    --mep-border: #e2e8f0;
    --mep-border-light: #f1f5f9;
    --mep-text: #0f172a;
    --mep-text-secondary: #475569;
    --mep-text-muted: #94a3b8;
    /* Status Colors */
    --status-success: #22c55e;
    --status-success-bg: #f0fdf4;
    --status-warning: #f59e0b;
    --status-warning-bg: #fffbeb;
    --status-danger: #ef4444;
    --status-danger-bg: #fef2f2;
    --status-info: #3b82f6;
    --status-info-bg: #eff6ff;
    /* 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), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;
}

/* ============================================
   BASE STYLES
   ============================================ */
html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    background: var(--mep-bg) !important; /* Tarayıcı önbellek ezmesini engellemek için */
    font-family: var(--font-sans);
    color: var(--mep-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   FOCUS STATES
   ============================================ */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 2px var(--mep-primary-light), 0 0 0 4px var(--mep-primary);
    outline: none;
}

/* ============================================
   CALCULATOR CARD GRID (Home Page Optimizations)
   ============================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-5);
    margin-bottom: 50px;
    content-visibility: auto; /* İlk açılış render performansını uçurur */
}

.calc-card {
    display: block;
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    background: var(--mep-card) !important;
    text-decoration: none;
    color: var(--mep-text);
    border: 1px solid var(--mep-border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    min-height: 120px; /* Görünmez büzüşmeyi önleyen kritik satır */
    opacity: 1 !important; /* Tarayıcı yüklenirken gizlenmesini engeller */
    will-change: transform;
}

    .calc-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-lg);
        border-color: var(--mep-primary-light);
    }

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-right: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--mep-primary-50);
    color: var(--mep-primary);
    font-size: 20px;
}

.card-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: var(--space-1);
    color: var(--mep-text);
}

.card-desc {
    font-size: 14px;
    color: var(--mep-text-secondary);
    line-height: 1.5;
}

/* ============================================
   CALCULATOR PAGE LAYOUT
   ============================================ */
.calculator-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-6);
}

.calculator-header {
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--mep-border);
}

    .calculator-header h1 {
        font-size: 28px;
        font-weight: 700;
        color: var(--mep-text);
        margin-bottom: var(--space-2);
    }

    .calculator-header .description {
        color: var(--mep-text-secondary);
        font-size: 15px;
    }

/* ============================================
   INPUT SECTIONS
   ============================================ */
.input-section {
    background: var(--mep-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    border: 1px solid var(--mep-border);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--mep-text);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--mep-border-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Category-based section colors */
.input-section.hvac-section .section-title {
    color: var(--cat-hvac);
    border-bottom-color: var(--cat-hvac-light);
}

.input-section.hydraulics-section .section-title {
    color: var(--cat-hydraulics);
    border-bottom-color: var(--cat-hydraulics-light);
}

.input-section.sanitary-section .section-title {
    color: var(--cat-sanitary);
    border-bottom-color: var(--cat-sanitary-light);
}

.input-section.converter-section .section-title {
    color: var(--cat-converter);
    border-bottom-color: var(--cat-converter-light);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--mep-text);
    margin-bottom: var(--space-2);
}

    .form-label .unit {
        font-weight: 400;
        color: var(--mep-text-muted);
        font-size: 12px;
    }

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--mep-text);
    background: var(--mep-card);
    border: 1.5px solid var(--mep-border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

    .form-control:hover {
        border-color: var(--mep-primary-light);
    }

    .form-control:focus {
        border-color: var(--mep-primary);
        box-shadow: 0 0 0 3px var(--mep-primary-light);
        outline: none;
    }

    .form-control::placeholder {
        color: var(--mep-text-muted);
    }

.form-text {
    display: block;
    margin-top: var(--space-1);
    font-size: 12px;
    color: var(--mep-text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ============================================
   RESULT CARDS
   ============================================ */
.result-card {
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

    .result-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
        pointer-events: none;
    }

    .result-card .label {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        opacity: 0.9;
        margin-bottom: var(--space-3);
    }

    .result-card .value {
        font-size: 48px;
        font-weight: 800;
        line-height: 1;
        margin-bottom: var(--space-2);
        text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .result-card .unit {
        font-size: 18px;
        font-weight: 600;
        opacity: 0.85;
    }

    .result-card .meta {
        margin-top: var(--space-4);
        padding-top: var(--space-4);
        border-top: 1px solid rgba(255,255,255,0.2);
        font-size: 14px;
        opacity: 0.9;
    }

.result-card-primary {
    background: var(--mep-primary);
}

.result-card-success {
    background: var(--mep-secondary);
}

.result-card-warning {
    background: var(--mep-accent);
}

.result-card-danger {
    background: var(--status-danger);
}

/* ============================================
   INFO PANEL
   ============================================ */
.info-panel {
    background: var(--mep-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--mep-border);
    box-shadow: var(--shadow-sm);
}

.info-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--mep-border-light);
}

    .info-panel-header .icon {
        font-size: 24px;
    }

    .info-panel-header h4 {
        font-size: 16px;
        font-weight: 700;
        color: var(--mep-text);
        margin: 0;
    }

.info-content {
    font-size: 14px;
    color: var(--mep-text-secondary);
    line-height: 1.7;
}

.info-key-points {
    margin-top: var(--space-4);
}

    .info-key-points li {
        margin-bottom: var(--space-2);
        padding-left: var(--space-2);
    }

/* ============================================
   CHART CONTAINER
   ============================================ */
.chart-container {
    background: var(--mep-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    border: 1px solid var(--mep-border);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   STATUS BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.badge-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.badge-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger);
}

.badge-info {
    background: var(--status-info-bg);
    color: var(--status-info);
}

/* ============================================
   DATA TABLE
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

    .data-table th {
        background: var(--mep-bg);
        padding: 10px 12px;
        text-align: left;
        font-weight: 600;
        color: var(--mep-text);
        border-bottom: 2px solid var(--mep-border);
    }

    .data-table td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--mep-border-light);
        color: var(--mep-text-secondary);
    }

    .data-table tr:hover td {
        background: var(--mep-primary-50);
    }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .calculator-page {
        padding: var(--space-4);
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .result-card .value {
        font-size: 36px;
    }
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.mep-header {
    background: var(--mep-card);
    border-bottom: 1px solid var(--mep-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.mep-header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mep-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.mep-logo-img {
    height: 40px;
    width: auto;
}

.mep-nav {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.mep-nav-link {
    color: var(--mep-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
}

    .mep-nav-link:hover {
        color: var(--mep-primary);
        background: var(--mep-primary-50);
    }

    .mep-nav-link[onclick*="print"] {
        background: var(--mep-primary);
        color: white;
    }

        .mep-nav-link[onclick*="print"]:hover {
            background: var(--mep-primary-dark);
            color: white;
        }

/* ============================================
   FOOTER
   ============================================ */
.mep-footer {
    margin-top: 60px;
    padding: var(--space-6);
    background: var(--mep-card);
    border-top: 1px solid var(--mep-border);
}

.mep-footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    color: var(--mep-text-muted);
    font-size: 13px;
}

.mep-footer-date {
    margin-top: var(--space-2);
    font-size: 12px;
}

.calculator-page {
    padding-top: var(--space-4);
}

/* ============================================
   ADDITIONAL UTILITY CLASSES
   ============================================ */
.engineering-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.insight-box {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--mep-border);
}

.insight-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--mep-primary);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--mep-primary-100);
}

.insight-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--mep-border-light);
}

    .insight-section:last-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    .insight-section h5 {
        font-size: 12px;
        font-weight: 600;
        color: var(--mep-text);
        margin: 0 0 8px 0;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

.print-header {
    background: linear-gradient(135deg, var(--mep-primary-dark) 0%, var(--mep-primary) 100%);
    color: white;
    padding: 24px 20px;
    border-radius: var(--radius-lg);
    text-align: center;
    margin-bottom: 20px;
}

    .print-header .logo {
        font-size: 16px;
        font-weight: 800;
        margin-bottom: 8px;
        letter-spacing: 1px;
    }

    .print-header h1 {
        font-size: 22px;
        font-weight: 700;
        margin: 0 0 6px 0;
    }

    .print-header .subtitle {
        font-size: 13px;
        opacity: 0.9;
        font-weight: 500;
    }

    .print-header .date {
        font-size: 11px;
        margin-top: 10px;
        opacity: 0.8;
    }

.print-footer {
    text-align: center;
    margin-top: 24px;
    padding: 16px;
    color: var(--mep-text-muted);
    font-size: 10px;
    border-top: 1px solid var(--mep-border);
    background: var(--mep-bg);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

    .print-footer .logo {
        font-size: 14px;
        font-weight: 800;
        color: var(--mep-primary);
        margin-bottom: 4px;
    }

.btn-print {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--mep-primary) 0%, var(--mep-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    width: 100%;
    margin-top: 12px;
}

    .btn-print:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

    .btn-print:active {
        transform: translateY(0);
    }

.calculator-grid-3col {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 20px;
    align-items: start;
}

@media (max-width: 1200px) {
    .calculator-grid-3col {
        grid-template-columns: 1fr;
    }

    .col-info {
        order: 3;
    }
}

.calculator-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--mep-border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.btn-calc {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--mep-primary) 0%, var(--mep-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}

    .btn-calc:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-md);
    }

.site-footer {
    background: linear-gradient(135deg, var(--mep-bg-dark) 0%, var(--mep-bg) 100%);
    border-top: 1px solid var(--mep-border);
    padding: 24px 20px;
    margin-top: 40px;
    text-align: center;
}

    .site-footer .footer-logo {
        font-size: 16px;
        font-weight: 800;
        color: var(--mep-primary);
        margin-bottom: 8px;
    }

    .site-footer .footer-text {
        font-size: 12px;
        color: var(--mep-text-muted);
        line-height: 1.6;
    }

    .site-footer .footer-links {
        display: flex;
        justify-content: center;
        gap: 20px;
        margin-top: 12px;
        font-size: 11px;
    }

        .site-footer .footer-links a {
            color: var(--mep-primary);
            text-decoration: none;
            font-weight: 500;
        }

            .site-footer .footer-links a:hover {
                text-decoration: underline;
            }

.navbar-brand {
    font-weight: 700;
    color: var(--mep-primary) !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .navbar-brand img {
        border-radius: 6px;
    }

.nav-link {
    font-weight: 500;
    color: var(--mep-text-secondary) !important;
    transition: color 0.2s ease;
    padding: 8px 16px !important;
    border-radius: 6px;
}

    .nav-link:hover {
        color: var(--mep-primary) !important;
        background: var(--mep-primary-50);
    }

.variables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.variable-item {
    background: var(--mep-bg);
    padding: 8px;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 11px;
}

.variable-symbol {
    font-family: 'Times New Roman', serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--mep-primary);
    display: block;
}

.variable-name {
    color: var(--mep-text-secondary);
    display: block;
    margin-top: 2px;
}

.variable-unit {
    color: var(--mep-text-muted);
    font-size: 10px;
    display: block;
}

/* ============================================
   PRINT OVERRIDES
   ============================================ */
@media print {
    .navbar,
    .site-footer,
    .mep-footer,
    .btn-print,
    .btn-calc,
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        padding: 0 !important;
    }

    .section,
    .calculator-card,
    .insight-box,
    .chart-container,
    .input-section,
    .info-panel {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #e2e8f0 !important;
    }

    .print-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .result-card {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}
