/* =============================================================
   ElekTra – Elektrik Fatura Hesaplama  |  frontend.css
   ============================================================= */

.elektra-calculator {
    max-width: 820px;
    margin: 0 auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #1e293b;
    line-height: 1.5;
}

.elektra-calculator * {
    box-sizing: border-box;
}

/* ── Başlık ── */
.ec-header {
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 60%, #3b82f6 100%);
    color: #fff;
    padding: 28px 32px 24px;
    border-radius: 16px 16px 0 0;
}

.ec-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 14px;
}

.ec-header-icon {
    font-size: 32px;
    background: rgba(255,255,255,.15);
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ec-header-text h2 {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.2;
}

.ec-header-text p {
    color: rgba(255,255,255,.8);
    font-size: 13px;
    margin: 0;
}

.ec-update-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.22);
    color: rgba(255,255,255,.9);
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 20px;
}

.ec-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Adım göstergesi ── */
.ec-steps-bar {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-top: none;
    padding: 14px 32px;
    margin-bottom: 20px;
}

.ec-step-item {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: .38;
    transition: opacity .3s;
}

.ec-step-item.active { opacity: 1; }
.ec-step-item.done   { opacity: .75; }

.ec-step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #cbd5e1;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .3s;
    flex-shrink: 0;
}

.ec-step-item.active .ec-step-circle { background: #2563eb; }
.ec-step-item.done   .ec-step-circle { background: #16a34a; }

.ec-step-item span {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    white-space: nowrap;
}

.ec-step-line {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin: 0 10px;
}

/* ── Hata mesajı ── */
.ec-error-msg {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
}

/* ── Kart ── */
.ec-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    transition: box-shadow .2s;
}

.ec-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
}

.ec-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.ec-card-num {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ec-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* ── Form grid & alanlar ── */
.ec-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.ec-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.ec-field:last-child { margin-bottom: 0; }

.ec-field label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ec-label-badge {
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.ec-field input[type="number"],
.ec-field input[type="text"],
.ec-field select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    color: #1e293b;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    appearance: auto;
}

.ec-field input:focus,
.ec-field select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.ec-field select:disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}

/* ── Birim-input sarıcı ── */
.ec-input-unit-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.ec-input-unit-wrap:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.ec-input-unit-wrap input[type="number"] {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    flex: 1;
    padding: 10px 14px;
    font-size: 15px;
    color: #1e293b;
    background: transparent;
}

.ec-input-unit-wrap input:focus {
    outline: none;
    box-shadow: none !important;
}

.ec-unit {
    background: #f1f5f9;
    color: #64748b;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    border-left: 1px solid #e2e8f0;
    white-space: nowrap;
    flex-shrink: 0;
}

.ec-hint {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

/* ── Şirket bilgi kartı ── */
.ec-company-badge {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 13px;
    color: #166534;
    line-height: 1.6;
}

.ec-company-badge strong { color: #15803d; }

/* ── Abonelik tipi radio kartları ── */
.ec-abone-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.ec-abone-card {
    cursor: pointer;
    display: block;
    user-select: none;
}

.ec-abone-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.ec-abone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 14px 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    transition: border-color .18s, background .18s, transform .15s;
    text-align: center;
}

.ec-abone-inner:hover {
    border-color: #93c5fd;
    background: #f8fafc;
    transform: translateY(-1px);
}

.ec-abone-card input:checked + .ec-abone-inner {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.ec-abone-icon {
    font-size: 22px;
    line-height: 1;
}

.ec-abone-title {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
}

.ec-abone-card input:checked + .ec-abone-inner .ec-abone-title {
    color: #1d4ed8;
}

.ec-abone-sub {
    font-size: 10px;
    color: #94a3b8;
}

/* ── Mesken günlük tarife ── */
.ec-mesken-extra {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-top: 4px;
}

.ec-daily-avg {
    background: #fefce8;
    border: 1px solid #fde047;
    border-radius: 6px;
    padding: 9px 13px;
    font-size: 13px;
    color: #854d0e;
    margin-top: 8px;
    line-height: 1.5;
}

/* ── Form butonları ── */
.ec-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.ec-btn-primary {
    flex: 1;
    padding: 14px 24px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .3px;
    transition: transform .15s, box-shadow .15s;
}

.ec-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37,99,235,.35);
}

.ec-btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

.ec-btn-secondary {
    padding: 14px 20px;
    background: #fff;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.ec-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #374151;
}

.ec-btn-outline {
    padding: 13px 20px;
    background: #fff;
    color: #2563eb;
    border: 1.5px solid #2563eb;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.ec-btn-outline:hover { background: #eff6ff; }

/* ── Yükleniyor ── */
.ec-loading {
    text-align: center;
    padding: 60px 20px;
}

.ec-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: ec-spin .8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes ec-spin { to { transform: rotate(360deg); } }

.ec-loading p {
    color: #64748b;
    font-size: 15px;
    margin: 0;
}

/* ── Sonuç wrapper ── */
.ec-result-wrapper {
    animation: ec-fadeup .4s ease;
}

@keyframes ec-fadeup {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Sonuç: başlık */
.ec-result-header {
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8 60%, #2563eb);
    color: #fff;
    padding: 24px 28px;
    border-radius: 12px 12px 0 0;
}

.ec-result-header h3 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.ec-result-company-name {
    font-size: 14px;
    color: rgba(255,255,255,.85);
    margin-bottom: 12px;
}

.ec-result-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ec-result-meta-item {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Sonuç: gövde */
.ec-result-body {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
}

/* Sonuç: kalem listesi */
.ec-breakdown {
    padding: 20px 24px 4px;
}

.ec-breakdown-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.ec-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.ec-breakdown-row:last-child { border-bottom: none; }

.ec-breakdown-label {
    color: #475569;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.ec-tag {
    background: #f1f5f9;
    color: #64748b;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.ec-breakdown-amount {
    font-weight: 600;
    color: #1e293b;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Sonuç: ara toplam / KDV */
.ec-subtotal-row,
.ec-kdv-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 24px;
    font-size: 14px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
}

.ec-subtotal-row { background: #f8fafc; }

/* Sonuç: genel toplam */
.ec-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-radius: 0 0 12px 12px;
}

.ec-total-label {
    font-size: 14px;
    font-weight: 700;
    color: #166534;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.ec-total-amount {
    font-size: 30px;
    font-weight: 800;
    color: #15803d;
    font-variant-numeric: tabular-nums;
}

/* Sonuç: notlar */
.ec-unit-price-note {
    padding: 10px 24px;
    font-size: 12px;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 4px;
}

/* Sonuç: aksiyon butonları */
.ec-result-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.ec-result-actions .ec-btn-primary { flex: 1; }

/* ── Alt bilgi ── */
.ec-footer {
    margin-top: 24px;
    padding: 16px 0;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.ec-footer p {
    color: #94a3b8;
    font-size: 12px;
    margin: 0 0 4px;
    line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .ec-header { padding: 20px; border-radius: 12px 12px 0 0; }
    .ec-header-text h2 { font-size: 19px; }
    .ec-steps-bar { padding: 12px 16px; }
    .ec-step-item span { display: none; }
    .ec-card { padding: 18px; }
    .ec-form-grid { grid-template-columns: 1fr; }
    .ec-abone-grid { grid-template-columns: repeat(3, 1fr); }
    .ec-total-amount { font-size: 24px; }
    .ec-result-header { padding: 18px 20px; }
    .ec-breakdown { padding: 16px 18px 4px; }
    .ec-subtotal-row, .ec-kdv-row { padding: 9px 18px; }
    .ec-total-row { padding: 16px 18px; }
}

@media (max-width: 420px) {
    .ec-abone-grid { grid-template-columns: repeat(2, 1fr); }
    .ec-abone-card:last-child { grid-column: span 2; }
    .ec-actions { flex-direction: column; }
    .ec-result-actions { flex-direction: column; }
}

/* ── Yazdırma ── */
@media print {
    .ec-form, .ec-steps-bar, .ec-header,
    .ec-result-actions, .ec-actions, .ec-footer,
    #elektra-error { display: none !important; }

    .ec-result-wrapper { display: block !important; }

    .ec-result-header {
        background: #1d4ed8 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .ec-total-row {
        background: #dcfce7 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
