:root {
    --primary: #4f46e5;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;

    /* Dashboard Colors */
    --blue: #3b82f6;
    --red: #ef4444;
    --green: #10b981;
    --cyan: #06b6d4;
    --purple: #8b5cf6;
    --orange: #f59e0b;
    --teal: #14b8a6;
    --indigo: #6366f1;
    --blue-light: #60a5fa;
    --green-soft: #dcfce7;
    --sidebar-width: 280px;

    --nav-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: calc(var(--nav-height) + 20px);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header */
.header {
    background: #fff;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-logo {
    height: 50px;
    max-width: 200px;
    object-fit: contain;
    transition: transform 0.2s;
}

.header-logo:hover {
    transform: scale(1.02);
}

@media (max-width: 480px) {
    .header-logo {
        height: 45px;
        max-width: 180px;
    }

    .header {
        padding: 0.75rem 1rem;
    }
}

.menu-btn {
    font-size: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.user-profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 12px;
    transition: background 0.2s;
    text-decoration: none;
}

.user-profile-header:hover {
    background: #f1f5f9;
}

.user-profile-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-info-text {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
}

@media (max-width: 640px) {
    .user-info-text {
        display: none;
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Main Dashboard Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-radius: 16px;
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 2rem;
    margin-right: 1.25rem;
    opacity: 0.9;
}

.card-info .category {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    opacity: 0.8;
    text-transform: uppercase;
}

.card-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

/* Colors */
.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.cyan {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.purple-grad {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.gray-grad {
    background: linear-gradient(135deg, #475569, #1e293b);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Quick Actions */
.quick-actions h2 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.action-card {
    background: #fff;
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: background 0.2s;
    border: 1px solid #e2e8f0;
}

.action-card:hover {
    background: #f1f5f9;
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #fff;
}

.action-card span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Action Icon Colors */
.purple {
    background-color: #f3e8ff;
    color: #9333ea;
}

.orange {
    background-color: #fff7ed;
    color: #ea580c;
}

.blue-light {
    background-color: #eff6ff;
    color: #3b82f6;
}

.teal {
    background-color: #f0fdfa;
    color: #0d9488;
}

.indigo {
    background-color: #eef2ff;
    color: #4f46e5;
}

.green-soft {
    background-color: #dcfce7;
    color: #15803d;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: #fff;
    z-index: 2500;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    visibility: hidden;
    /* Ensure it's hidden when not open */
}

.sidebar.open {
    transform: translateX(0);
    visibility: visible;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.sidebar-nav {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-muted);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #f1f5f9;
    color: var(--primary);
}

.sidebar-nav a:hover i,
.sidebar-nav a.active i {
    color: var(--primary);
}

.sidebar-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 1rem 0;
}

.sidebar-nav a.logout {
    margin-top: auto;
    color: var(--red);
}

.sidebar-nav a.logout i {
    color: var(--red);
}

/* Sidebar Profile Section */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    margin: 0 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
    border: 1px solid #e2e8f0;
}

.sidebar-profile:hover {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.sidebar-profile-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-profile-info {
    flex: 1;
}

.sidebar-profile-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
}

.sidebar-profile-role {
    font-size: 0.7rem;
    color: #fff;
    background: #3b82f6;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Company Logo in Sidebar */
.sidebar-company-logo {
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 0.5rem;
}

.sidebar-company-logo img {
    max-width: 120px;
    max-height: 50px;
    object-fit: contain;
    opacity: 0.8;
    filter: grayscale(20%);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    z-index: 1000;
}

.nav-item {
    flex: 1;
    /* Equal width for all items */
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.65rem;
    /* Slightly smaller for mobile with 5 items */
    gap: 4px;
    min-width: 0;
    text-align: center;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item.active {
    color: var(--primary);
}

.nav-qr-container {
    position: relative;
    top: -20px;
}

.qr-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 50%;
    border: 5px solid #fff;
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.5);
    cursor: pointer;
    transition: transform 0.2s;
}

.qr-btn:active {
    transform: scale(0.9);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.scanner-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.viewport {
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#interactive video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#reader {
    width: 100% !important;
}

#reader__scan_region {
    background: #000 !important;
}

.scanner-laser {
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: red;
    box-shadow: 0 0 10px red;
    animation: scan 2s infinite ease-in-out;
}

@keyframes scan {
    0% {
        top: 20%;
    }

    50% {
        top: 80%;
    }

    100% {
        top: 20%;
    }
}

.scanner-footer {
    padding: 1rem;
    text-align: center;
}

#barcode-input {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1.25rem;
    text-align: center;
}

/* Tablet & PC Adjustments */
@media (min-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Modern Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: #fff;
    color: #1e293b;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    min-width: 280px;
    border-left: 4px solid #3b82f6;
    animation: slideIn 0.3s ease-out forwards;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast i {
    font-size: 1.1rem;
}

.toast.success i {
    color: #10b981;
}

.toast.error i {
    color: #ef4444;
}

.toast.warning i {
    color: #f59e0b;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto;
    }
}

/* Settings Sidebar Layout */
.settings-layout {
    display: flex;
    min-height: calc(100vh - 70px);
}

.settings-sidebar {
    width: 280px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.settings-sidebar-nav {
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    color: #64748b;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-sidebar-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.settings-sidebar-link:hover {
    background: #f1f5f9;
    color: #3b82f6;
}

.settings-sidebar-link.active {
    background: #eff6ff;
    color: #3b82f6;
    box-shadow: inset 0 0 0 1px #dbeafe;
}

.settings-main {
    flex: 1;
    overflow-x: hidden;
    padding: 1rem 0 3rem;
}

@media (max-width: 992px) {
    .settings-sidebar {
        position: fixed;
        left: 0;
        top: 70px;
        bottom: 0;
        transform: translateX(-100%);
    }

    .settings-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }
}

.settings-overlay {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.settings-overlay.show {
    display: block;
    opacity: 1;
}

/* Custom Hamburger for Settings */
.settings-menu-toggle {
    display: none;
    background: #f1f5f9;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

@media (max-width: 992px) {
    .settings-menu-toggle {
        display: flex;
    }
}

/* Settings Components */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-card {
    background: #fff;
    border-radius: 16px;
    margin: 0 1rem 1.5rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .form-row {
        grid-template-columns: 1fr 1fr;
    }

    .form-row.triple {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 5px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #f8fafc;
    transition: all 0.2s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.btn-add {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-add:active {
    transform: translateY(0);
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.list-table th {
    text-align: left;
    padding: 12px;
    font-size: 0.75rem;
    color: #94a3b8;
    border-bottom: 1px solid #f1f5f9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.list-table td {
    padding: 14px 12px;
    font-size: 0.95rem;
    border-bottom: 1px solid #f8fafc;
    color: #1e293b;
}

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #eff6ff;
    color: #3b82f6;
    text-transform: uppercase;
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        padding-bottom: 80px;
        /* Nav height + padding */
    }

    .container {
        padding: 1rem;
    }

    /* Grid Adjustments - USER REQUEST: 2 Columns on Mobile */
    .card-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        /* Kesinlikle 2 sütun */
        gap: 10px !important;
    }

    /* Kart içeriğini mobilde dikey yap ki sığsın */
    .dashboard-card {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 1rem 0.5rem !important;
        min-height: 110px;
        justify-content: center;
    }

    .card-icon {
        margin-right: 0 !important;
        margin-bottom: 0.5rem !important;
        font-size: 1.5rem !important;
    }

    .card-info h3 {
        font-size: 0.9rem !important;
        line-height: 1.2;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .action-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Settings Page Mobile Fix */
    .settings-layout {
        display: block;
        margin: 0;
        padding: 0;
    }

    .settings-sidebar {
        position: fixed;
        left: 0;
        top: 70px;
        bottom: 0;
        width: 280px;
        height: calc(100% - 70px);
        background: #fff;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid #e2e8f0;
        visibility: visible !important;
    }

    .settings-overlay {
        top: 70px;
        z-index: 1000;
    }

    .settings-sidebar.open {
        transform: translateX(0);
    }

    .settings-sidebar-nav {
        padding: 20px 15px;
    }

    .settings-sidebar-link {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .settings-content {
        padding: 1rem !important;
        overflow-y: visible !important;
        /* Ensure content is scrollable */
        height: auto !important;
    }

    /* Reports Page Overflow Fix */
    .chart-container,
    .report-card {
        overflow-x: auto;
        /* Allow horizontal scroll for charts */
        width: 100%;
    }

    canvas {
        max-width: 100%;
        height: auto !important;
    }

    /* Table Fixes */
    .table-container,
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
    }

    table {
        min-width: 600px;
        /* Force scroll */
    }

    /* Modal Fixes */
    .modal-content {
        width: 95% !important;
        margin: 10% auto !important;
        padding: 1.25rem !important;
    }

    /* Supplier Detail Fixes */
    .timeline {
        padding: 0 0 4rem !important;
    }

    .timeline-item {
        padding: 1rem !important;
    }

    .group-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .group-header>div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px dashed #e2e8f0;
        padding-top: 8px;
    }

    /* Header & Navigation */
    .header-content {
        padding: 0;
    }

    .header-title {
        font-size: 1rem;
    }

    /* Input & Form Elements */
    input,
    select,
    textarea {
        font-size: 16px !important;
        /* Prevent zoom on iOS */
    }
}

@media (max-width: 480px) {
    .action-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .search-box input {
        width: 100%;
    }
}