/* ═══════════════════════════════════════════════════════════════
   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 */

@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;
    }
}
