:root {
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --bg-soft: #f3f4f6;
    --text-muted: #6b7280;
    --blue: #1e90ff;
    --red: #ef4444;
    --green: #10b981;
    --amber: #f59e0b;
    --purple: #8b5cf6;
    --gray: #6b7280;
    --line: #e5e7eb;
}

* { 
    box-sizing: border-box; 
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-soft);
    color: #111827;
    font-size: 14px;
    line-height: 1.4;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* Toolbar Stilleri */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 12px;
}

.filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    border: 1px solid var(--line);
    background: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.chip:hover {
    border-color: var(--blue);
    background-color: #f8fafc;
}

.chip.active {
    border-color: var(--blue);
    color: var(--blue);
    background-color: #dbeafe;
}

.search {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 240px;
    font-size: 14px;
}

.search:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.1);
}

/* Tablo Stilleri - Yeni Ledger Stili */
table.ledger {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

.ledger thead th {
    text-align: left;
    padding: 12px;
    background: var(--bg-soft);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--line);
}

.ledger tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    font-size: 14px;
}

.ledger tbody tr:hover {
    background-color: #f9fafb;
}

.ledger tbody tr:last-child td {
    border-bottom: none;
}

.num {
    text-align: right;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.desc {
    color: var(--text-muted);
}

.kaydeden {
    color: var(--text-muted);
    font-style: italic;
}

.actions {
    text-align: center;
    width: 60px;
}

/* İşlem Türü Etiketleri */
.tag {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 11px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-satış {
    background: var(--blue);
}

.tag-iade {
    background: var(--red);
}

.tag-ödeme {
    background: var(--green);
}

.tag-irsaliye {
    background: var(--gray);
}

.tag-sipariş {
    background: var(--purple);
}

/* Kart Stilleri */
.summary-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--line);
    transition: all 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.summary-icon {
    font-size: 24px;
}

.summary-title {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    margin: 8px 0 0 0;
    color: #111827;
}

.card-table {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--line);
    overflow: hidden;
}

.card-table .card-header {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    padding: 16px 20px;
}

.card-table .table thead th {
    background: transparent;
    border-top: none;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-table .table tbody td {
    border-top: none;
    padding: 12px 20px;
}

.card-table .table tbody tr:hover {
    background-color: #f9fafb;
}

.btn-group-sm .btn {
    font-size: 12px;
}

/* Sayfalama Stilleri */
#pager {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 12px;
}

#pager .btn {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    min-width: 36px;
}

/* Badge İyileştirmeleri */
.badge.bg-primary-subtle {
    background-color: #dbeafe !important;
    color: var(--blue) !important;
    font-weight: 500;
}

/* Modal İyileştirmeleri */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    background: white;
    overflow: hidden;
}

.modal-header {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.btn-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.btn-close::before {
    content: "×";
    font-size: 24px;
    line-height: 1;
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow: auto;
}

.modal-footer {
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    padding: 16px 20px;
}

body.modal-open {
    overflow: hidden;
}

/* Alert İyileştirmeleri */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Form İyileştirmeleri */
.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.1);
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

/* Detail Table için özel stiller */
table.detail {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.detail th,
.detail td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.detail th {
    background: var(--bg-soft);
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail .num {
    text-align: right;
    font-family: 'Courier New', monospace;
}

.detail tfoot th {
    background: #dbeafe;
    color: var(--blue);
    font-weight: 700;
}

/* Responsive */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters {
        justify-content: center;
        margin-bottom: 10px;
    }
    
    .search {
        min-width: auto;
    }
    
    .ledger thead th {
        font-size: 10px;
        padding: 8px 6px;
    }
    
    .ledger tbody td {
        font-size: 12px;
        padding: 8px 6px;
    }
    
    .tag {
        font-size: 9px;
        padding: 2px 6px;
    }
    
    .summary-card {
        padding: 15px;
    }
    
    .summary-value {
        font-size: 20px;
    }
    
    #pager {
        justify-content: center;
    }
}

/* Modern Login Card */
.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border: none;
}

/* Modern Admin Dashboard Improvements */
.bg-primary-subtle { 
    background-color: #e7f3ff !important; 
    color: #0969da !important; 
}

.bg-success-subtle { 
    background-color: #dcfce7 !important; 
    color: #16a34a !important; 
}

.bg-secondary-subtle { 
    background-color: #f1f5f9 !important; 
    color: #475569 !important; 
}

.bg-info-subtle { 
    background-color: #e0f2fe !important; 
    color: #0891b2 !important; 
}

/* Enhanced Button Styles */
.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Modern Table Enhancements */
.table-responsive {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Enhanced Form Controls */
.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Smooth Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeInUp 0.5s ease-out;
}

/* Modern Badge Enhancements */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
    border-radius: 8px;
}

/* Genel Mobil Uyumluluk İyileştirmeleri */
@media (max-width: 1200px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .navbar-brand {
        font-size: 18px;
    }
    
    .summary-card {
        margin-bottom: 20px;
    }
}

@media (max-width: 992px) {
    .navbar-collapse {
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255,255,255,0.2);
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-link {
        padding: 8px 15px;
        margin: 2px 0;
        border-radius: 6px;
        transition: background-color 0.2s;
    }
    
    .navbar-nav .nav-link:hover {
        background-color: rgba(255,255,255,0.1);
    }
    
    .card-table .table-responsive {
        font-size: 14px;
    }
    
    .btn-group-sm .btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    main.container-fluid {
        padding: 15px 10px;
    }
    
    .alert {
        margin-bottom: 15px;
        padding: 12px 15px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    .card {
        border-radius: 12px;
        margin-bottom: 20px;
    }
    
    .card-header {
        padding: 15px 20px;
        font-size: 16px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .btn-lg {
        padding: 12px 24px;
        font-size: 16px;
    }
    
    /* Form iyileştirmeleri */
    .form-control {
        padding: 10px 15px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    .form-label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 6px;
    }
    
    /* Tablo mobil uyumluluk */
    .table-responsive {
        border-radius: 12px;
        margin-bottom: 20px;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 10px 12px;
        vertical-align: middle;
    }
    
    .table thead th {
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Badge iyileştirmeleri */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    /* Modal iyileştirmeleri */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
    }
}

@media (max-width: 576px) {
    main.container-fluid {
        padding: 10px 5px;
    }
    
    .navbar-brand {
        font-size: 16px;
    }
    
    .card-header {
        padding: 12px 15px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 5px;
    }
    
    .form-control {
        font-size: 16px; /* iOS zoom engellemek için */
    }
    
    .table-responsive {
        border: none;
        box-shadow: none;
    }
    
    /* Mobil için kart tabloları */
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive th,
    .table-responsive td,
    .table-responsive tr {
        display: block;
    }
    
    .table-responsive thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .table-responsive tr {
        background: white;
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        border: 1px solid #e9ecef;
    }
    
    .table-responsive td {
        border: none !important;
        position: relative;
        padding: 8px 0 8px 50% !important;
        text-align: left !important;
    }
    
    .table-responsive td:before {
        content: attr(data-label) ":";
        position: absolute;
        left: 0;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #6c757d;
        font-size: 12px;
        text-transform: uppercase;
    }
    
    .modal-dialog {
        margin: 5px;
    }
    
    .modal-header {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .modal-body {
        padding: 15px;
    }
}

@media (max-width: 400px) {
    .navbar-brand {
        font-size: 14px;
    }
    
    .card-header {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .card-body {
        padding: 12px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .table-responsive tr {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .table-responsive td {
        padding: 6px 0 6px 45% !important;
        font-size: 12px;
    }
    
    .table-responsive td:before {
        font-size: 11px;
        width: 40%;
    }
}

/* === Inline invoice detail (accordion) === */
tr.invoice-row { cursor: pointer; }
tr.invoice-row:hover { background: #fafafa; }
tr.invoice-detail-row { display: none; background: #fcfcff; }
tr.invoice-detail-row > td { padding: 12px 16px; border-top: 1px dashed var(--line); }

/* Expanded state */
tr.invoice-row[aria-expanded="true"] + tr.invoice-detail-row { display: table-row; }

/* Mobile card style for table rows */
@media (max-width: 640px) {
  table#extre.table { border-collapse: separate; border-spacing: 0 10px; }
  table#extre thead { display: none; }
  table#extre tbody tr.invoice-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  table#extre tbody tr.invoice-row td { display: contents; }
  table#extre tbody tr.invoice-row td:nth-child(1) { grid-column: 1 / -1; }
  table#extre tbody tr.invoice-detail-row { display: none; }
  table#extre tbody tr.invoice-row[aria-expanded="true"] + tr.invoice-detail-row { display: table-row; }
  table#extre tbody tr.invoice-detail-row td { background: #f9fafb; border-radius: 0 0 12px 12px; }
}


/* === Anti-overflow hardening for mainTable === */
#mainTable{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0}
#mainTable td,#mainTable th{word-wrap:break-word;overflow-wrap:anywhere}
@media (max-width:640px){
  #mainTable thead{display:none}
  #mainTable tbody tr.invoice-row{display:grid;grid-template-columns:1fr auto;gap:6px 8px;padding:12px;margin-bottom:10px;border:1px solid var(--line);border-radius:12px;background:#fff}
  #mainTable tbody tr.invoice-row>td{display:contents}
  #mainTable tbody tr.invoice-row>td:nth-child(1){grid-column:1/-1}
  #mainTable tbody tr.invoice-row>td:nth-child(n+3){display:none}
  #mainTable tbody tr.invoice-detail-row>td{display:block;background:#f9fafb;border-radius:0 0 12px 12px}
}
