/* ============================================
   ENVANTER YÖNETİM - ANA STİL
   ============================================ */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --bg: #f9fafb;
    --sidebar-bg: #1f2937;
    --sidebar-text: #e5e7eb;
    --sidebar-active: #4f46e5;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

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

/* ============================================
   AUTH (LOGIN)
   ============================================ */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.auth-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo svg { color: var(--primary); margin-bottom: 12px; }
.auth-logo h1 { font-size: 22px; color: var(--gray-900); margin-bottom: 4px; }
.auth-logo p { color: var(--gray-500); font-size: 13px; }
.auth-footer { text-align: center; margin-top: 24px; color: var(--gray-400); }

/* ============================================
   LAYOUT
   ============================================ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: white; }
.logo-icon { font-size: 24px; }
.sidebar-close { display: none; background: none; border: none; color: white; font-size: 28px; cursor: pointer; }

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 14px;
    margin-bottom: 2px;
    transition: var(--transition);
}
.nav-item:hover { background: rgba(255,255,255,0.06); text-decoration: none; color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.04);
    margin-bottom: 8px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}
.user-info { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--gray-400); }

.sidebar-footer .btn {
    display: inline-block;
    margin-right: 4px;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title { font-size: 18px; font-weight: 600; color: var(--gray-900); flex: 1; }
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--gray-700);
}
.topbar-right { display: flex; gap: 12px; align-items: center; }
.company-badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
}
.company-switcher {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid var(--primary);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    max-width: 220px;
}
.company-switcher:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.content-wrapper { padding: 24px; max-width: 1400px; width: 100%; }

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.card-body { padding: 20px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-900); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-ghost { background: transparent; color: var(--gray-100); border-color: rgba(255,255,255,0.2); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 13px;
}
.form-group label .req { color: var(--danger); }
.form-control, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"], input[type="tel"],
select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: var(--transition);
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
textarea { resize: vertical; min-height: 80px; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.form-hint { color: var(--gray-500); font-size: 12px; margin-top: 4px; }

/* ============================================
   TABLES
   ============================================ */
.table-wrapper { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}
.table th {
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.table tbody tr:hover { background: var(--gray-50); }
.table td.actions { text-align: right; white-space: nowrap; }
.table td.actions .btn { margin-left: 4px; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid;
    font-size: 13px;
}
.alert-success { background: var(--success-light); border-color: var(--success); color: #065f46; }
.alert-error { background: var(--danger-light); border-color: var(--danger); color: #991b1b; }
.alert-warn { background: var(--warning-light); border-color: var(--warning); color: #92400e; }
.alert-info { background: var(--info-light); border-color: var(--info); color: #1e40af; }

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.stat-icon.primary { background: var(--primary-light); }
.stat-icon.success { background: var(--success-light); }
.stat-icon.warning { background: var(--warning-light); }
.stat-icon.danger { background: var(--danger-light); }
.stat-info { flex: 1; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}
.modal-backdrop.active { display: flex; }
.modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    margin: 40px auto;
    overflow: hidden;
}
.modal.modal-lg { max-width: 900px; }
.modal.modal-sm { max-width: 400px; }
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    line-height: 1;
}
.modal-body { padding: 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================
   TOOLBAR
   ============================================ */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }
.search-box {
    position: relative;
    min-width: 240px;
}
.search-box input { padding-left: 36px; }
.search-box::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.5;
}

/* ============================================
   PRODUCT DETAIL
   ============================================ */
.product-detail {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
}
.product-image {
    background: var(--gray-100);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image .no-image { font-size: 60px; opacity: 0.3; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}
.detail-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}
.detail-item .value { font-size: 14px; color: var(--gray-900); font-weight: 500; }

/* ============================================
   QR
   ============================================ */
.qr-preview {
    display: inline-block;
    padding: 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    text-align: center;
}
.qr-preview img, .qr-preview canvas, .qr-preview svg {
    display: block;
    max-width: 150px;
    height: auto;
}
.qr-label { font-size: 11px; margin-top: 6px; color: var(--gray-600); font-family: monospace; }

.qr-print-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10mm;
    padding: 10mm;
}
.qr-print-card {
    border: 1px dashed #999;
    padding: 8mm;
    text-align: center;
    break-inside: avoid;
}
.qr-print-card img { display: block; margin: 0 auto 4mm; max-width: 35mm; }
.qr-print-card .pname { font-size: 11pt; font-weight: bold; }
.qr-print-card .psku  { font-size: 9pt; color: #666; margin-top: 2mm; }

@media print {
    .no-print, .sidebar, .topbar { display: none !important; }
    .app-layout { display: block; }
    .main-content { padding: 0; }
    .content-wrapper { padding: 0; max-width: none; }
    body { background: white; }
    .card, .card-header, .card-body { box-shadow: none; border: none; padding: 0; margin: 0; }
}

/* ============================================
   MISC
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--gray-700); margin-bottom: 8px; }

.text-muted { color: var(--gray-500); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; }
.hidden { display: none; }

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    color: var(--gray-700);
    font-size: 13px;
}
.pagination a:hover { background: var(--gray-100); text-decoration: none; }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .product-detail { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0; left: 0;
        z-index: 200;
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-toggle { display: block; }
    .content-wrapper { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .qr-print-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .qr-print-grid { grid-template-columns: 1fr; }
    .topbar { padding: 12px 16px; }
    .page-title { font-size: 16px; }
    .company-badge { font-size: 11px; padding: 4px 8px; }
}
