:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #0ea5e9; /* Mavi/Yeşil arası temiz depo teması */
    --primary-hover: #0284c7;
    --border: #e2e8f0;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --success: #10b981;
    --success-bg: #ecfdf5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
}

.app-container {
    display: flex;
    width: 100%;
    flex: 1;
    min-height: 0;
}

/* Top navbar (shared across all tools; scoped to avoid clashing with this
   page's own .logo/.btn used inside the sidebar) */
header.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}
header.navbar .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
}
header.navbar .nav-links {
    display: flex;
    gap: 1.5rem;
}
header.navbar .nav-links a {
    color: #334155;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}
header.navbar .nav-links a:hover {
    color: #2563eb;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.logo {
    padding: 20px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.menu {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.menu-item:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

.menu-item.active {
    background-color: #f0f9ff;
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

/* Main Content */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 30px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.topbar h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 15px;
    width: 300px;
}

.search-bar svg {
    color: var(--text-muted);
}

.search-bar input {
    border: none;
    outline: none;
    padding: 12px 10px;
    width: 100%;
    font-size: 14px;
    background: transparent;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stat-title {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card.alert .stat-value {
    color: var(--danger);
}

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

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

th, td {
    padding: 15px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

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

.text-center {
    text-align: center;
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* Stock Controls */
.stock-control {
    display: inline-flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.stock-control button {
    background: white;
    border: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.2s;
}

.stock-control button:hover {
    background: #e2e8f0;
}

.stock-control .val {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal {
    background: white;
    width: 450px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

.modal-header h2 {
    font-size: 18px;
}

.close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

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

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

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

input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
}

.btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }
.w-100 { width: 100%; }

/* Print */
@media print {
    .sidebar, .search-bar, .modal-overlay, .stock-control button, th:last-child, td:last-child, .navbar {
        display: none !important;
    }
    .content {
        padding: 0;
        overflow: visible;
    }
    .table-container {
        border: none;
        box-shadow: none;
    }
    table {
        border: 1px solid #ccc;
    }
    th, td {
        border: 1px solid #ccc;
        padding: 8px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container { flex-direction: column !important; height: auto !important; }
    .sidebar { width: 100% !important; min-width: 100% !important; border-right: none !important; border-bottom: 1px solid #e2e8f0; height: auto !important; padding: 15px !important; box-sizing: border-box !important; }
    .preview-panel { width: 100% !important; padding: 10px !important; overflow-x: auto !important; }
    .invoice-wrapper, .document-wrapper, .cv-wrapper, .quotation-wrapper, .expense-wrapper, .payroll-wrapper, .inventory-wrapper, .shift-wrapper { min-width: 700px; transform: scale(1) !important; transform-origin: top left; }
    .header-left, .header-right { width: 100% !important; text-align: left !important; margin-bottom:10px; }
    .invoice-header, .cv-header, .quotation-header { flex-direction: column !important; gap: 1rem !important; }
    .actions { flex-direction: column !important; }
    .btn { width: 100% !important; margin-bottom: 5px; }
    /* .table-container uses overflow:hidden for its rounded-corner card
       look, which also means the stock table's 6 columns were simply
       clipped and permanently unreachable on narrow screens - not just
       hard to scroll, actually inaccessible. Switch to a scrollable
       container at mobile, same scroll-hint pattern as payroll/shift. */
    .table-container {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-container::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, rgba(15, 23, 42, 0.12));
        pointer-events: none;
    }
    #inventory-table {
        min-width: 600px;
    }
}

/* Per-tool FAQ section */
.tool-faq-section {
    max-width: 900px;
    margin: 0 auto 40px;
    padding: 0 20px;
}
.tool-faq-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin-bottom: 20px;
}
.tool-faq-section .faq-item {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    margin-bottom: 10px;
    background: #ffffff;
    overflow: hidden;
}
.tool-faq-section .faq-item summary {
    cursor: pointer;
    padding: 14px 44px 14px 18px;
    font-weight: 600;
    color: var(--text-main, #0f172a);
    font-size: 0.95rem;
    list-style: none;
    position: relative;
}
.tool-faq-section .faq-item summary::-webkit-details-marker {
    display: none;
}
.tool-faq-section .faq-item summary::after {
    content: '+';
    position: absolute;
    right: 18px;
    top: 12px;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--primary, #2563eb);
    transition: transform 0.2s;
}
.tool-faq-section .faq-item[open] summary::after {
    transform: rotate(45deg);
}
.tool-faq-section .faq-item summary:hover {
    background: #f8fafc;
}
.tool-faq-section .faq-item p {
    padding: 0 18px 16px;
    margin: 0;
    color: var(--text-muted, #64748b);
    font-size: 0.9rem;
    line-height: 1.65;
}
.tool-faq-section .faq-item p a {
    color: var(--primary, #2563eb);
}

/* Related Tools cross-links */
.related-tools-section {
    max-width: 900px;
    margin: 0 auto 24px;
    padding: 0 20px;
}
.related-tools-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main, #0f172a);
    margin-bottom: 20px;
}
.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.related-tool-card {
    display: block;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    padding: 16px 18px;
    background: #ffffff;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.related-tool-card:hover {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.1);
}
.related-tool-card strong {
    display: block;
    color: var(--primary, #2563eb);
    font-size: 0.95rem;
    margin-bottom: 6px;
}
.related-tool-card span {
    display: block;
    color: var(--text-muted, #64748b);
    font-size: 0.85rem;
    line-height: 1.5;
}
@media (max-width: 768px) {
    .related-tools-grid {
        grid-template-columns: 1fr;
    }
}
