/* ═══════════════════════════════════════════════════════════════
   MODAL STYLES
   ═══════════════════════════════════════════════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

    .modal-overlay.active {
        display: flex !important;
    }

.modal-container {
    background: white;
    border-radius: 16px;
    padding: 0;
    max-width: 680px;   /* varsayılan: modal-md */
    width: 95%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

/* ─── Modal Genişlik Sınıfları ───────────────────────────────────────────
   Kullanım: <div class="modal-container modal-sm">
   ─────────────────────────────────────────────────────────────────────── */
.modal-container.modal-xs  { max-width: 420px; }   /* onay / bilgi     */
.modal-container.modal-sm  { max-width: 520px; }   /* basit form       */
.modal-container.modal-md  { max-width: 680px; }   /* standart CRUD    */
.modal-container.modal-lg  { max-width: 860px; }   /* geniş form       */
.modal-container.modal-xl  { max-width: 1100px; }  /* tablo / detay    */
.modal-container.modal-xxl  { max-width: 1360px; }  /* geniş tablo / rapor */
.modal-container.modal-xxxl { max-width: 1600px; }  /* tam ekran genişliği  */

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-light);
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

    .modal-title i {
        color: var(--primary);
    }

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 8px;
    transition: all 0.2s;
    line-height: 1;
}

    .modal-close:hover {
        background: var(--bg-light);
        color: var(--danger);
    }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-light);
}

/* Modal Detail Table */
.modal-detail-table {
    width: 100%;
    border-collapse: collapse;
}

    .modal-detail-table tr {
        border-bottom: 1px solid var(--border);
    }

        .modal-detail-table tr:last-child {
            border-bottom: none;
        }

    .modal-detail-table td {
        padding: 12px 0;
        vertical-align: top;
    }

        .modal-detail-table td:first-child {
            font-weight: 600;
            color: var(--text-secondary);
            width: 140px;
            padding-right: 20px;
        }

        .modal-detail-table td:last-child {
            color: var(--text-primary);
        }

    .modal-detail-table code {
        background: var(--bg-light);
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 13px;
        font-family: 'Consolas', monospace;
        word-break: break-all;
    }

    .modal-detail-table .error-text {
        color: var(--danger);
    }

    .modal-detail-table .success-text {
        color: var(--success);
    }

    .modal-detail-table a {
        color: var(--primary);
        text-decoration: none;
        word-break: break-all;
    }

        .modal-detail-table a:hover {
            text-decoration: underline;
        }

/* Modal Sections */
.modal-section {
    margin-bottom: 20px;
}

    .modal-section:last-child {
        margin-bottom: 0;
    }

.modal-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ff6f0f;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ff6f0f;
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-container {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-body {
        max-height: calc(100vh - 140px);
    }

    .modal-detail-table td:first-child {
        width: 100px;
        font-size: 13px;
    }
}
/* ═══════════════════════════════════════════════════════════════════════════
   MODAL İÇİ FORM DÜZENİ - TÜM MODALLAR İÇİN
   ═══════════════════════════════════════════════════════════════════════════ */

/* Modal Body Scroll */
.modal-container {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Modal Section */
.modal-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

    .modal-section:last-of-type {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL İÇİ FORM ROW - GRID LAYOUT (ÇAKIŞMAYI ÖNLE)
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-body .form-row {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
}

    .modal-body .form-row.cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .modal-body .form-row.cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }

/* Form Group - Modal içinde tam genişlik */
.modal-body .form-group {
    width: 100%;
    margin-bottom: 1rem;
}

    .modal-body .form-group:last-child {
        margin-bottom: 0;
    }

/* Form Input - Modal içinde tam genişlik */
.modal-body .form-input,
.modal-body input.form-input,
.modal-body textarea.form-input,
.modal-body select.form-input {
    width: 100%;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE - MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .modal-container {
        width: 95% !important;
        max-width: 95% !important;
        margin: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

        .modal-body .form-row {
            grid-template-columns: 1fr !important;
        }

            .modal-body .form-row.cols-3,
            .modal-body .form-row.cols-4 {
                grid-template-columns: 1fr !important;
            }
}

@media (max-width: 576px) {
    .modal-container {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
        max-height: calc(100vh - 130px);
    }

    .modal-footer {
        padding: 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ÖNİZLEME MODALI
   ═══════════════════════════════════════════════════════════════════════════ */

.onizleme-uyari {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    color: #1e40af;
    font-size: 14px;
    font-weight: 500;
}

.onizleme-uyari i {
    font-size: 18px;
    flex-shrink: 0;
}

/* Bölüm başlık satırı */
.modal-detail-table tr.onizleme-bolum td {
    padding: 16px 0 8px 0;
    border-bottom: 2px solid #ff6f0f;
    color: #ff6f0f;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.modal-detail-table tr.onizleme-bolum:first-child td {
    padding-top: 0;
}

/* Değer hücresinde badge */
.modal-detail-table .badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.modal-detail-table .badge-success {
    background: #dcfce7;
    color: #166534;
}

.modal-detail-table .badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

.modal-detail-table .badge-info {
    background: #e0f2fe;
    color: #075985;
}

.modal-detail-table .badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.modal-detail-table .badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   YARDIM TAB İÇERİĞİ
   ═══════════════════════════════════════════════════════════════════════════ */

.yardim-icerik {
    max-width: 900px;
}

.yardim-bolum {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.yardim-bolum:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.yardim-bolum h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary, #ff6f0f);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.yardim-bolum h4 i {
    font-size: 18px;
}

.yardim-tablo {
    width: 100%;
    border-collapse: collapse;
}

.yardim-tablo tr {
    border-bottom: 1px solid #f1f5f9;
}

.yardim-tablo tr:last-child {
    border-bottom: none;
}

.yardim-tablo td {
    padding: 10px 0;
    vertical-align: top;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-primary, #1e293b);
}

.yardim-tablo td:first-child {
    width: 160px;
    padding-right: 16px;
    white-space: nowrap;
    color: var(--text-secondary, #475569);
}

.yardim-tablo td em {
    background: #f8fafc;
    padding: 1px 6px;
    border-radius: 3px;
    font-style: normal;
    color: var(--primary, #ff6f0f);
    font-weight: 500;
}

.yardim-tablo .badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

.yardim-tablo .badge-info { background: #e0f2fe; color: #075985; }
.yardim-tablo .badge-success { background: #dcfce7; color: #166534; }
.yardim-tablo .badge-warning { background: #fef3c7; color: #92400e; }
.yardim-tablo .badge-danger { background: #fee2e2; color: #991b1b; }
.yardim-tablo .badge-secondary { background: #f1f5f9; color: #475569; }
