/* ============================================================
   B2BPAZAR - Ana CSS Dosyasi
   tasarim.md rehberine uygun, dinamik renk sistemi destekler
   ============================================================ */

/* CSS Degiskenleri - Firma bazli renk ozellestirme */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --primary-light: rgba(0, 123, 255, 0.1);
    --primary-focus: rgba(0, 123, 255, 0.15);

    --success: #28a745;
    --success-hover: #1e7e34;
    --success-bg: #d4edda;
    --success-text: #155724;

    --danger: #dc3545;
    --danger-hover: #c82333;
    --danger-bg: #f8d7da;
    --danger-text: #721c24;

    --warning: #ffc107;
    --warning-hover: #e0a800;
    --warning-bg: #fff3cd;
    --warning-text: #856404;

    --info: #17a2b8;
    --info-hover: #0c5460;
    --info-bg: #d1ecf1;
    --info-text: #0c5460;

    --secondary: #6c757d;
    --secondary-hover: #545b62;
    --secondary-bg: #e9ecef;
    --secondary-text: #495057;

    --white: #ffffff;
    --gray-1: #f8f9fa;
    --gray-2: #f5f5f5;
    --gray-3: #e9ecef;
    --gray-4: #dee2e6;
    --gray-5: #ced4da;
    --text-dark: #2c3e50;
    --text-normal: #495057;
    --text-light: #6c757d;
    --text-muted: #999;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-deep: 0 6px 20px rgba(0, 0, 0, 0.12);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.3);

    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 20px;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

* {
    box-sizing: border-box;
}

*::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-normal);
    background: var(--gray-2);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 12px 0;
    color: var(--text-dark);
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }

p { margin: 0 0 12px 0; }

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 24px 20px;
}

/* ============================================================
   HEADER
   ============================================================ */

.app-header {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .header-left,
.app-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.app-header .logo img {
    height: 36px;
}

.app-header .nav-btn {
    background: var(--white);
    border: none;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-normal);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-header .nav-btn:hover {
    background: var(--gray-1);
    color: var(--primary-color);
}

.app-header .nav-btn.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
}

/* Bildirim zili */
.notification-bell {
    position: relative;
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-normal);
    font-size: 22px;
}

.notification-bell:hover {
    color: var(--primary-color);
}

.notification-bell .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

/* ============================================================
   BUTONLAR
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1.5;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-focus);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
    text-decoration: none;
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: var(--success-hover);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: var(--danger-hover);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: #212529;
}
.btn-warning:hover {
    background: var(--warning-hover);
    color: #212529;
}

.btn-info {
    background: var(--info);
    color: white;
}
.btn-info:hover {
    background: var(--info-hover);
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}
.btn-secondary:hover {
    background: var(--secondary-hover);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius);
}

.btn-block {
    width: 100%;
}

/* ============================================================
   FORM ELEMANLARI
   ============================================================ */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-normal);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-5);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--white);
    color: var(--text-normal);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    font-family: inherit;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 3px var(--primary-focus);
    outline: none;
}

.form-control:disabled {
    background: var(--gray-3);
    cursor: not-allowed;
    color: var(--text-light);
}

.form-control::placeholder {
    color: #adb5bd;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-text {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-light);
}

.form-error {
    margin-top: 4px;
    font-size: 12px;
    color: var(--danger);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23495057' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
}

/* ============================================================
   KARTLAR
   ============================================================ */

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--gray-3);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.card-body {
    /* default */
}

.card-footer {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px solid var(--gray-3);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.card-hover {
    transition: all 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Istatistik Kartlari */
.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-card .stat-icon {
    float: right;
    font-size: 32px;
    color: var(--primary-color);
    opacity: 0.3;
}

.stat-card.stat-success { border-left-color: var(--success); background: linear-gradient(135deg, #ffffff 0%, #f8fdf9 100%); }
.stat-card.stat-success .stat-icon { color: var(--success); }
.stat-card.stat-warning { border-left-color: var(--warning); background: linear-gradient(135deg, #ffffff 0%, #fffdf8 100%); }
.stat-card.stat-warning .stat-icon { color: var(--warning); }
.stat-card.stat-danger { border-left-color: var(--danger); background: linear-gradient(135deg, #ffffff 0%, #fdf8f8 100%); }
.stat-card.stat-danger .stat-icon { color: var(--danger); }
.stat-card.stat-info { border-left-color: var(--info); background: linear-gradient(135deg, #ffffff 0%, #f8fcfd 100%); }
.stat-card.stat-info .stat-icon { color: var(--info); }
.stat-card.stat-primary { background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%); }

/* ============================================================
   GRID
   ============================================================ */

.grid {
    display: grid;
    gap: 16px;
}

.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 992px) {
    .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   UYARILAR (ALERT)
   ============================================================ */

.alert {
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-bg);
    border-color: #c3e6cb;
    border-left: 5px solid var(--success);
    color: var(--success-text);
}

.alert-danger {
    background: var(--danger-bg);
    border-color: #f5c6cb;
    border-left: 5px solid var(--danger);
    color: var(--danger-text);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: #ffeaa7;
    border-left: 5px solid var(--warning);
    color: var(--warning-text);
}

.alert-info {
    background: var(--info-bg);
    border-color: #bee5eb;
    border-left: 5px solid var(--info);
    color: var(--info-text);
}

/* ============================================================
   TABLOLAR
   ============================================================ */

.table-wrapper {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--gray-1);
}

.table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-normal);
    border-bottom: 2px solid var(--gray-3);
    letter-spacing: 0.3px;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-3);
    font-size: 14px;
    vertical-align: middle;
    color: var(--text-normal);
}

.table tbody tr:hover {
    background: var(--gray-1);
}

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

.table-actions {
    display: flex;
    gap: 6px;
}

/* ============================================================
   BADGE
   ============================================================ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    line-height: 1.4;
}

.badge-primary { background: var(--primary-light); color: var(--primary-color); }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-secondary { background: var(--secondary-bg); color: var(--secondary-text); }

/* Durum badge'leri */
.status-pending { background: var(--warning-bg); color: var(--warning-text); }
.status-confirmed { background: var(--info-bg); color: var(--info-text); }
.status-preparing { background: var(--info-bg); color: var(--info-text); }
.status-shipped { background: var(--primary-light); color: var(--primary-color); }
.status-delivered { background: var(--success-bg); color: var(--success-text); }
.status-cancelled { background: var(--danger-bg); color: var(--danger-text); }

/* ============================================================
   LOGIN SAYFASI
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f5f5 0%, #e9ecef 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-deep);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header img {
    max-height: 80px;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 22px;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .btn-block {
    margin-top: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-light);
}

.login-footer a {
    color: var(--primary-color);
}

/* ============================================================
   LOADING
   ============================================================ */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-3);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-state .spinner {
    margin: 0 auto 16px;
}

.loading-state p {
    color: var(--text-light);
    margin: 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--gray-4);
    display: block;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--text-normal);
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 14px;
    margin: 0;
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-light); }
.text-bold { font-weight: 600; }

.d-none { display: none; }
.d-flex { display: flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }

.flex-1 { flex: 1; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.w-100 { width: 100%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 992px) {
    .main-content { padding: 20px 16px; }
}

@media (max-width: 768px) {
    .app-header {
        padding: 10px 16px;
        flex-wrap: wrap;
    }
    .login-card { padding: 32px 24px; }
    h1 { font-size: 20px; }
    h2 { font-size: 18px; }

    /* Mobil tablo - kart goruntumune don */
    .table-responsive thead { display: none; }
    .table-responsive tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--gray-3);
        border-radius: var(--radius-md);
        padding: 8px;
    }
    .table-responsive td {
        display: flex;
        justify-content: space-between;
        padding: 8px 12px;
        border-bottom: 1px solid var(--gray-3);
    }
    .table-responsive td:last-child { border-bottom: none; }
    .table-responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-normal);
    }
}

@media (max-width: 480px) {
    .login-card { padding: 24px 20px; }
    .stat-card { padding: 20px; }
    .stat-card .stat-value { font-size: 24px; }
}

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-1);
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-3);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Form grid (modal içinde 2 kolonlu form) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 576px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .modal {
        max-width: 100%;
    }
}

/* ============================================================
   TOOLBAR (Sayfa üstü araç çubuğu)
   ============================================================ */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-input {
    position: relative;
}

.search-input input {
    padding-left: 36px;
    min-width: 260px;
}

.search-input i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

/* Filter butonları */
.filter-btn {
    padding: 8px 14px;
    border: 1px solid var(--gray-4);
    border-radius: var(--radius-pill);
    background: var(--white);
    color: var(--text-normal);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--gray-4);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-normal);
    transition: all 0.2s ease;
    text-decoration: none;
}

.pagination a:hover {
    background: var(--gray-1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    text-decoration: none;
}

.pagination .active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Confirm dialog */
.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}
