/* ==========================================================================
   IMS - MODERN ERP DASHBOARD STYLE (TAM KAPSAMLI BİRLEŞTİRİLMİŞ SÜRÜM)
   Tüm Sayfalar: Teklif, Proforma, Servis Formları, Müşteriler, Takvim, Stok
   ========================================================================== */

:root {
    --ims-primary: #2563eb;
    --ims-primary-hover: #1d4ed8;
    --ims-success: #10b981;
    --ims-danger: #ef4444;
    --ims-warning: #f59e0b;
    --ims-proforma: #7c3aed;
    --ims-taslak: #9a3412;
    --ims-bg: #f8fafc;
    --ims-border: #e2e8f0;
    --ims-text-main: #1e293b;
    --ims-text-muted: #64748b;
    --ims-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

/* ==========================================================================
   1. GLOBAL TAM EKRAN VE MERKEZİ HİZALAMA
   ========================================================================== */
.ims-form-container, .ims-soft-container, .ims-full-width, .ims-main-panel, .ims-urun-ekle-panel {
    width: 100% !important; 
    max-width: 1400px !important; 
    margin: 0 auto !important; 
    position: relative !important;
    left: auto !important; 
    right: auto !important;
    padding: 30px 20px !important;
    box-sizing: border-box !important;
    background: var(--ims-bg);
    min-height: 100vh;
}

#primary, #main, #content, .site-content, .container {
    max-width: 100% !important; 
    padding: 0 !important; 
    margin: 0 auto !important; 
}

.ims-card {
    background: #ffffff; border: 1px solid var(--ims-border);
    border-radius: 12px; padding: 25px; box-shadow: var(--ims-shadow);
    margin-bottom: 25px; width: 100%; box-sizing: border-box;
}

.ims-header-bar { margin-bottom: 25px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }

.ims-sayfa-baslik {
    font-size: 1.6rem; font-weight: 800; color: var(--ims-text-main);
    display: flex; align-items: center; gap: 12px; margin: 0;
}
.header-with-icon { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; }

/* ==========================================================================
   2. GENEL BUTON MİMARİSİ
   ========================================================================== */
button, .ims-btn, .ims-btn-back, .ims-btn-soft-secondary, .ims-btn-mini, .action-btn, .ims-modul-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 8px; border: none; cursor: pointer; transition: all 0.2s ease;
    text-decoration: none !important; font-weight: 600; font-family: inherit;
}

.ims-btn-back { color: var(--ims-text-muted); font-size: 14px; background: transparent; }
.ims-btn-back:hover { color: var(--ims-primary); }

.ims-btn-soft-secondary { background: #e2e8f0; color: #475569; padding: 10px 16px; font-size: 14px; }
.ims-btn-soft-secondary:hover { background: #cbd5e1; transform: translateY(-1px); }

.ims-btn-mini { padding: 8px 12px; background: var(--ims-primary); color: #fff; font-size: 12px; }
.ims-btn-mini:hover { background: var(--ims-primary-hover); }

.btn-save-large { width: 100%; padding: 16px; font-size: 16px; background: var(--ims-success); color: white; margin-top: 20px; }
.btn-save-large:hover { opacity: 0.9; transform: translateY(-2px); }

.action-btn { padding: 6px 10px; font-size: 11px; color: #fff !important; }
.action-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-edit { background: var(--ims-warning); }
.btn-save { background: var(--ims-success); }
.btn-delete { background: var(--ims-danger); }
.btn-pdf { background: #334155; }
.btn-proforma { background: var(--ims-proforma); }
.btn-done { background: #94a3b8; cursor: not-allowed; }

/* ==========================================================================
   3. FORM, INPUT VE ARAMA ALANLARI
   ========================================================================== */
.ims-grid-row { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 15px; }
.ims-grid-row.align-end { align-items: flex-end; }
.ims-input-group { flex: 1 1 200px; display: flex; flex-direction: column; gap: 8px; }

.ims-input-group label { font-size: 13px; font-weight: 600; color: var(--ims-text-muted); }

.ims-input-soft, .ims-input {
    width: 100%; padding: 12px 15px; border: 1px solid var(--ims-border);
    border-radius: 8px; background: #fff; font-size: 14px; color: var(--ims-text-main);
    box-sizing: border-box; transition: border 0.2s;
}
.ims-input-soft:focus, .ims-input:focus { outline: none; border-color: var(--ims-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.highlight-kur { background: #fffbeb !important; border-color: var(--ims-warning) !important; font-weight: 700; color: #b45309; }

/* ==========================================================================
   4. TABLO MİMARİSİ
   ========================================================================== */
.ims-table-responsive { width: 100%; overflow-x: auto; border-radius: 8px; border: 1px solid var(--ims-border); margin-bottom: 15px; }
.ims-soft-table, .ims-table { width: 100%; min-width: 900px; border-collapse: collapse; background: #fff; }
.ims-soft-table th, .ims-table th { background: #f8fafc; padding: 15px; text-align: left; font-weight: 600; color: var(--ims-text-main); border-bottom: 2px solid var(--ims-border); }
.ims-soft-table td, .ims-table td { padding: 15px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }

/* ==========================================================================
   5. MODAL (AÇILIR PENCERE) MİMARİSİ
   ========================================================================== */
.ims-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    z-index: 999999; display: flex; justify-content: center; align-items: center;
    padding: 20px; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.ims-modal-overlay.active, .ims-modal-overlay[style*="display: flex"], .ims-modal-overlay[style*="display: block"] {
    opacity: 1 !important; visibility: visible !important; display: flex !important;
}
.ims-modal-content {
    background: #ffffff; width: 100%; max-width: 900px; border-radius: 16px;
    display: flex; flex-direction: column; max-height: 85vh;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); overflow: hidden;
}
.ims-modal-header { padding: 20px 25px; border-bottom: 1px solid var(--ims-border); display: flex; justify-content: space-between; align-items: center; background: #f8fafc; }
.ims-modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: #94a3b8; line-height: 1; padding: 0; }
.ims-modal-close:hover { color: var(--ims-danger); }
.ims-modal-body { padding: 25px; overflow-y: auto; flex: 1; }
.ims-modal-footer { padding: 15px 20px; background: #fcfcfd; text-align: right; border-top: 1px solid var(--ims-border); }

/* ==========================================================================
   6. SAYFALARA ÖZEL BİLEŞENLER VE STOK GÖRSELLERİ
   ========================================================================== */
.ims-modul-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.ims-modul-btn {
    justify-content: flex-start; padding: 20px; background: #ffffff; border: 1px solid var(--ims-border);
    border-left: 6px solid #ccc; border-radius: 12px; color: var(--ims-text-main) !important; font-size: 15px;
}
.ims-modul-btn:hover { transform: translateY(-4px); box-shadow: var(--ims-shadow); background: #fdfdfd; }
.btn-blue { border-left-color: #3b82f6 !important; } .btn-green { border-left-color: #10b981 !important; } .btn-orange { border-left-color: #f59e0b !important; }

.ims-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; margin-bottom: 30px; }
.ims-summary-box { padding: 25px; border-radius: 15px; border: 1px solid var(--ims-border); }
.box-income { background: #f0fdf4; border-color: #bbf7d0; }
.box-expense { background: #fef2f2; border-color: #fecaca; }

.signature-box { background: #f8fafc; border: 1px dashed #cbd5e0; padding: 20px; border-radius: 12px; text-align: center; }
.canvas-wrapper {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; margin: 10px 0;
    position: relative; width: 100%; height: 200px; overflow: hidden; touch-action: none;
}
canvas { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; cursor: crosshair; }
.input-danger-border { border-color: #fca5a5 !important; }

.ims-task-list { display: flex; flex-direction: column; gap: 12px; }
.ims-task-card {
    display: flex; justify-content: space-between; align-items: center; padding: 15px 20px;
    border: 1px solid var(--ims-border); border-radius: 10px; background: #fff; border-left: 5px solid #cbd5e1;
}
.task-done { border-left-color: var(--ims-success) !important; background: #f0fdf4; }
.task-ongoing { border-left-color: var(--ims-primary) !important; background: #eff6ff; }
.task-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.task-meta { text-align: right; min-width: 120px; font-size: 12px; color: var(--ims-text-muted); }

.ims-image-upload-box {
    width: 100%; height: 150px; border: 2px dashed #cbd5e0; border-radius: 8px;
    background: #f7fafc; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
}
.ims-image-upload-box img { width: 100%; height: 100%; object-fit: contain; }

.customer-info-card { background: #f8fafc; border-left: 5px solid #6b8eaa !important; padding: 20px; border-radius: 12px; margin-bottom: 20px; }
.customer-title { margin: 0 0 10px 0; color: #2d3748; font-size: 22px; }

/* Stok Listesi Resimleri */
.ims-table-img, .ims-no-img-placeholder {
    width: 50px !important; height: 50px !important; object-fit: contain !important; 
    border-radius: 8px; border: 1px solid var(--ims-border); background: #fff; display: inline-block;
}

/* ==========================================================================
   7. MOBİL UYUM VE TEMA BOŞLUKLARINI ZORLA SIFIRLAMA (768px Altı)
   TÜM MOBİL KODLAR BU SÜSLÜ PARANTEZİN İÇİNDE KALMALIDIR
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* Genel Boşluklar */
    .ims-form-container, .ims-soft-container, .ims-full-width { padding: 15px 10px !important; }
    .ims-sayfa-baslik { font-size: 1.3rem; }
    
    /* GİZLİ WORDPRESS PARAGRAF ETİKETLERİNİ EZME (O devasa boşlukları yapan şey) */
    .ims-input-group p, .ims-card p, .ims-input-group br {
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
        display: none !important; /* Br etiketlerini tamamen yok eder */
    }

    /* KUTULAR ARASI BOŞLUKLARI DARALTMA (Tam Kapsamlı Reset) */
    .ims-grid-row { flex-direction: column; align-items: flex-start; gap: 8px !important; margin-bottom: 5px !important; }
    .ims-card { padding: 15px !important; margin-bottom: 15px !important; }
    .ims-header-bar { margin-bottom: 15px !important; }
    .flex-between { flex-direction: column; align-items: flex-start; gap: 10px !important; }
    
    .ims-input-group, .ims-search-wrapper, .ims-btn-soft-secondary, .btn-save-large { width: 100% !important; max-width: 100% !important; }
    .ims-input-group { gap: 2px !important; margin: 0 !important; padding: 0 !important; }

    /* Temanın kutu altlarına eklediği takozları sıfırla */
    .ims-input-soft, .ims-input, input[type="date"], input[type="number"], input[type="text"], select {
        margin-bottom: 0 !important; margin-top: 0 !important;
    }

    /* Modüller ve Özetler */
    .ims-modul-grid, .ims-summary-grid { grid-template-columns: 1fr; gap: 10px !important; }
    
    /* Tarih (Date) Inputlarının Mobilde Taşmasını Kesin Engelle */
    input[type="date"].ims-input-soft, input[type="date"].ims-input, input[type="date"] {
        width: 100% !important; max-width: 100% !important; min-width: 0 !important; 
        box-sizing: border-box !important; appearance: none; 
    }
    
    /* Tablolar Akıllı Kartlara Dönüşür */
    .ims-table-responsive { border: none; background: transparent; margin-top: 0; overflow-x: hidden; }
    .ims-soft-table, .ims-table { min-width: 100%; background: transparent; }
    .ims-soft-table thead, .ims-table thead { display: none; }
    .ims-soft-table tr, .ims-table tr { 
        display: block; border: 1px solid var(--ims-border); background: #fff;
        border-radius: 12px; margin-bottom: 10px !important; padding: 10px; 
        border-left: 5px solid var(--ims-primary); box-shadow: var(--ims-shadow);
    }
    .ims-soft-table td, .ims-table td { 
        display: flex; justify-content: space-between; align-items: center; 
        border-bottom: 1px solid #f1f5f9; padding: 10px 5px; text-align: right; width: 100%; box-sizing: border-box;
    }
    .ims-soft-table td:last-child, .ims-table td:last-child { border-bottom: none; }
    
    /* Tablo Resimleri Mobilde */
    .ims-soft-table td img, .ims-table td img, .ims-table-img {
        width: 40px !important; height: 40px !important; margin-left: auto; flex-shrink: 0;
    }
    .ims-soft-table td:has(img), .ims-table td:has(img) {
        display: flex !important; justify-content: space-between !important; align-items: center !important;
    }
    
    /* Tablo İçi Butonlar */
    .ims-action-buttons { display: flex; width: 100%; gap: 8px; justify-content: center; flex-wrap: wrap; }
    .ims-action-buttons .action-btn { flex: 1; justify-content: center; padding: 10px; }

    /* Modal ve Servis Formu İmza */
    .ims-modal-content { max-height: 100vh; height: 100vh; border-radius: 0; }
    .canvas-wrapper { height: 150px; }
    .ims-task-card { flex-direction: column; align-items: flex-start; }
    .task-meta { text-align: left; width: 100%; border-top: 1px dashed var(--ims-border); padding-top: 10px; margin-top: 10px; }
}