/* ============================================================
   Lalezar Ahşap — Stok Takip Sistemi
   Ana Stil Dosyası — Leylak Teması
   Yaşlı kullanıcı dostu: büyük yazı, yüksek kontrast
   ============================================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    --primary: #7c3aed;
    --primary-light: #c4b5fd;
    --primary-lighter: #ede9fe;
    --bg: #faf5ff;
    --primary-dark: #4c1d95;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --text: #1f2937;
    --text-light: #6b7280;
    --white: #ffffff;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 32px rgba(124, 58, 237, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --nav-height: 64px;
    --transition: 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

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

ul, ol {
    list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--primary-dark);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.625rem; }
h3 { font-size: 1.375rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin-bottom: 1rem;
}

p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   TOP NAVIGATION BAR
   ============================================================ */

.navbar {
    background: var(--primary);
    height: var(--nav-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 2px 8px rgba(76, 29, 149, 0.35);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.navbar-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    gap: 0;
}

/* Logo / App Name — left */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--white);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    transition: opacity var(--transition);
}

.navbar-brand:hover {
    color: var(--white);
    text-decoration: none;
    opacity: 0.9;
}

.navbar-brand-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.navbar-brand-icon svg {
    width: 22px;
    height: 22px;
    fill: var(--white);
}

/* Nav Links — centered */
.navbar-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    flex-wrap: nowrap;
}

.nav-link {
    color: rgba(255, 255, 255, 0.88);
    font-size: 17px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
    position: relative;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    color: var(--white);
    font-weight: 700;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--white);
    border-radius: 2px;
}

/* User info + Logout — right */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
}

.navbar-username {
    color: rgba(255, 255, 255, 0.88);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-username strong {
    color: var(--white);
    font-weight: 700;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-md);
    padding: 7px 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.6);
    color: var(--white);
    text-decoration: none;
}

/* Hamburger Button — mobile only */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-left: auto;
    transition: background var(--transition);
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.28);
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: var(--white);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

.hamburger.open span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* Stock alarm badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: var(--white);
    background: var(--danger);
    margin-left: 4px;
    flex-shrink: 0;
}

.badge-warning {
    background: var(--warning);
    color: var(--text);
}

.badge-success {
    background: var(--success);
}

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

.page-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.2;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 400;
}

.page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition), box-shadow var(--transition), transform 0.1s;
    line-height: 1.2;
    letter-spacing: 0.2px;
}

.btn:hover {
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Primary */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.30);
}

.btn-primary:hover {
    background: #6d28d9;
    box-shadow: 0 5px 16px rgba(124, 58, 237, 0.42);
    color: var(--white);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: var(--white);
    box-shadow: 0 3px 10px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
    background: #b91c1c;
    box-shadow: 0 5px 16px rgba(220, 38, 38, 0.35);
    color: var(--white);
}

/* Secondary */
.btn-secondary {
    background: var(--border);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #d1d5db;
    color: var(--text);
}

/* Success */
.btn-success {
    background: var(--success);
    color: var(--white);
    box-shadow: 0 3px 10px rgba(22, 163, 74, 0.25);
}

.btn-success:hover {
    background: #15803d;
    box-shadow: 0 5px 16px rgba(22, 163, 74, 0.35);
    color: var(--white);
}

/* Warning */
.btn-warning {
    background: var(--warning);
    color: var(--white);
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.25);
}

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

/* Small / Large variants */
.btn-sm {
    min-height: 38px;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    min-height: 56px;
    padding: 14px 32px;
    font-size: 18px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    min-height: 44px;
    min-width: 44px;
    padding: 10px;
}

/* ============================================================
   FORMS
   ============================================================ */

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

.form-label {
    display: block;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 8px;
    line-height: 1.3;
}

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

.form-control {
    width: 100%;
    min-height: 52px;
    font-size: 16px;
    font-family: inherit;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    outline: none;
    line-height: 1.4;
    appearance: none;
    -webkit-appearance: none;
}

.form-control::placeholder {
    color: #9ca3af;
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

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

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

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

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

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 44px;
}

.form-hint {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 6px;
    line-height: 1.4;
}

.form-error {
    font-size: 14px;
    color: var(--danger);
    margin-top: 6px;
    font-weight: 500;
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    min-height: 28px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--white);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    flex-shrink: 0;
}

.form-check input[type="radio"] {
    border-radius: 50%;
}

.form-check input[type="checkbox"]:checked,
.form-check input[type="radio"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.form-check input[type="radio"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='6' fill='white'/%3E%3C/svg%3E");
}

.form-check input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    border: 1px solid rgba(196, 181, 253, 0.25);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1.5px solid var(--primary-lighter);
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.3;
}

.card-body {
    /* content area inside card */
}

.card-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1.5px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   SUMMARY CARDS (Dashboard)
   ============================================================ */

.summary-cards {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}

.summary-card {
    flex: 1 1 200px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.summary-card.card-danger {
    border-left-color: var(--danger);
}

.summary-card.card-success {
    border-left-color: var(--success);
}

.summary-card.card-warning {
    border-left-color: var(--warning);
}

.summary-card-number {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1;
}

.summary-card.card-danger .summary-card-number {
    color: var(--danger);
}

.summary-card.card-success .summary-card-number {
    color: var(--success);
}

.summary-card.card-warning .summary-card-number {
    color: #b45309;
}

.summary-card-label {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
    line-height: 1.3;
}

.summary-card-icon {
    font-size: 2rem;
    margin-bottom: 4px;
}

/* ============================================================
   TABLES
   ============================================================ */

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    background: var(--white);
}

.data-table thead tr,
table thead tr {
    background: var(--primary-lighter);
}

.data-table thead th,
table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--primary-light);
    white-space: nowrap;
}

.data-table tbody tr,
table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.data-table tbody tr:nth-child(even),
table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.data-table tbody tr:hover,
table tbody tr:hover {
    background: var(--primary-lighter);
}

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

.data-table td,
table td {
    padding: 14px 16px;
    color: var(--text);
    vertical-align: middle;
}

.data-table tfoot td,
table tfoot td {
    padding: 14px 16px;
    font-weight: 700;
    background: var(--primary-lighter);
    color: var(--primary-dark);
    border-top: 2px solid var(--primary-light);
}

/* Column alignment helpers */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }

/* Stock alarm row — red tinted */
.stock-alarm {
    background: #fff5f5 !important;
}

.stock-alarm:hover {
    background: #ffe4e4 !important;
}

.stock-alarm td {
    color: #991b1b;
}

/* Table actions cell */
.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.5;
    border: 1.5px solid transparent;
}

.alert-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-text {
    flex: 1;
}

.alert-success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #14532d;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

.alert-warning {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #78350f;
}

.alert-info {
    background: var(--primary-lighter);
    border-color: var(--primary-light);
    color: var(--primary-dark);
}

/* Dismissable alert close button */
.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
    transition: opacity var(--transition);
}

.alert-close:hover {
    opacity: 1;
}

/* ============================================================
   NOTIFICATIONS (Toast)
   ============================================================ */

#notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100vw - 40px);
}

.notification {
    min-width: 300px;
    padding: 18px 20px;
    font-size: 17px;
    font-weight: 600;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: all;
    line-height: 1.4;
    animation: notificationSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
}

.notification.hiding {
    animation: notificationFadeOut 0.3s ease forwards;
}

.notification-success {
    background: #f0fdf4;
    border: 2px solid #86efac;
    color: #14532d;
}

.notification-danger {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    color: #7f1d1d;
}

.notification-warning {
    background: #fffbeb;
    border: 2px solid #fcd34d;
    color: #78350f;
}

.notification-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.notification-message {
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    flex-shrink: 0;
    transition: opacity var(--transition);
}

.notification-close:hover {
    opacity: 1;
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: currentColor;
    opacity: 0.3;
    border-radius: 0 0 0 var(--radius-lg);
    animation: notificationProgress 4s linear forwards;
}

@keyframes notificationSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes notificationFadeOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
        max-height: 200px;
        margin-bottom: 0;
    }
    to {
        opacity: 0;
        transform: translateX(60px) scale(0.9);
        max-height: 0;
        margin-bottom: -12px;
        padding-top: 0;
        padding-bottom: 0;
    }
}

@keyframes notificationProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ============================================================
   MODAL / CONFIRM DIALOG
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: modalOverlayIn 0.2s ease;
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: modalBoxIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

@keyframes modalBoxIn {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    line-height: 1;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 12px;
    line-height: 1.3;
}

.modal-message {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 28px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-actions .btn {
    min-width: 120px;
    min-height: 52px;
    font-size: 17px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.login-container {
    width: 100%;
    max-width: 420px;
}

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

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    background: var(--primary);
    border-radius: 18px;
    margin-bottom: 16px;
}

.login-logo svg {
    width: 40px;
    height: 40px;
    fill: var(--white);
}

.login-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-dark);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.login-subtitle {
    font-size: 1.0625rem;
    color: #6d28d9;
    margin-top: 6px;
    margin-bottom: 0;
}

.login-card {
    background: var(--white);
    border: 1.5px solid var(--primary-light);
    border-radius: 20px;
    padding: 40px 40px 36px;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.10);
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 0.9375rem;
    color: #8b5cf6;
}

/* Login form inputs — slightly larger */
.login-card .form-control {
    height: 56px;
    font-size: 18px;
    border-color: #ddd6fe;
    background: var(--bg);
}

.login-card .form-control::placeholder {
    color: #a78bfa;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.login-card .form-label {
    color: var(--primary-dark);
}

.login-card .btn-primary {
    height: 56px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.p-0 { padding: 0; }

/* Display */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* Text */
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: #b45309; }
.text-muted { color: var(--text-light); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fs-sm { font-size: 14px; }
.fs-lg { font-size: 18px; }

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    border: none;
    margin: 24px 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    display: block;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 24px;
}

/* Price tag */
.price {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1rem;
    white-space: nowrap;
}

.price-large {
    font-size: 1.5rem;
}

/* Status pill */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.status-active {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #86efac;
}

.status-inactive {
    background: #f9fafb;
    color: var(--text-light);
    border: 1px solid var(--border);
}

.status-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.status-danger {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 18px;
    pointer-events: none;
}

.search-input-wrapper .form-control {
    padding-left: 44px;
}

/* Image preview */
.img-preview {
    max-width: 120px;
    max-height: 120px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    object-fit: cover;
    display: block;
}

/* Product image thumbnail */
.product-thumb {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
}

.product-thumb-placeholder {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--primary-lighter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    border: 1.5px solid var(--primary-light);
}

/* Spinner */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--primary-lighter);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

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

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

/* ============================================================
   PAGINATION
   ============================================================ */

.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 24px;
}

.pagination-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

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

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

.pagination-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
   SIDEBAR / FILTER PANEL (optional)
   ============================================================ */

.filter-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.filter-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   RESPONSIVE — TABLET (<=1024px)
   ============================================================ */

@media (max-width: 1024px) {
    .page-content {
        padding: 20px 18px 40px;
    }

    .nav-link {
        font-size: 16px;
        padding: 7px 10px;
    }

    .summary-card {
        flex: 1 1 160px;
    }

    .login-card {
        padding: 32px 28px 28px;
    }

    .data-table thead th,
    table thead th {
        padding: 12px 12px;
    }

    .data-table td,
    table td {
        padding: 12px 12px;
    }
}

/* ============================================================
   RESPONSIVE — MOBILE (<=768px)
   ============================================================ */

@media (max-width: 768px) {

    /* Hamburger shows, nav links hide */
    .hamburger {
        display: flex;
    }

    .navbar-nav {
        display: none;
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: var(--primary-dark);
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px 20px;
        gap: 4px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
        z-index: 999;
        max-height: calc(100vh - var(--nav-height));
        overflow-y: auto;
    }

    .navbar-nav.active {
        display: flex;
    }

    .nav-link {
        font-size: 18px;
        padding: 14px 16px;
        border-radius: var(--radius-md);
        justify-content: flex-start;
        color: rgba(255, 255, 255, 0.9);
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-link.active {
        background: rgba(255, 255, 255, 0.2);
    }

    /* Hide username text on mobile, keep logout */
    .navbar-username {
        display: none;
    }

    .navbar-user {
        gap: 8px;
    }

    .btn-logout {
        font-size: 14px;
        padding: 6px 12px;
    }

    /* Page layout */
    .page-content {
        padding: 16px 14px 32px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
        justify-content: center;
    }

    /* Full-width buttons on mobile */
    .btn-block-mobile {
        width: 100%;
    }

    /* Cards */
    .card {
        padding: 18px 16px;
    }

    /* Summary cards stack */
    .summary-cards {
        flex-direction: column;
        gap: 14px;
    }

    .summary-card {
        flex: none;
        width: 100%;
    }

    .summary-card-number {
        font-size: 1.875rem;
    }

    /* Table-to-card: hide normal table, show card layout */
    .table-responsive {
        overflow-x: visible;
        box-shadow: none;
    }

    .table-responsive table,
    .table-responsive .data-table {
        display: block;
    }

    .table-responsive thead {
        display: none;
    }

    .table-responsive tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .table-responsive tbody tr {
        display: block;
        background: var(--white);
        border-radius: var(--radius-lg);
        padding: 16px;
        box-shadow: var(--shadow-md);
        border: 1px solid rgba(196, 181, 253, 0.25);
        border-left: 4px solid var(--primary-light);
    }

    .table-responsive tbody tr.stock-alarm {
        border-left-color: var(--danger);
        background: #fff5f5 !important;
    }

    .table-responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 4px;
        border-bottom: 1px solid #f3f4f6;
        font-size: 15px;
        gap: 12px;
    }

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

    .table-responsive tbody td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--primary-dark);
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        flex-shrink: 0;
        min-width: 100px;
    }

    .table-responsive tfoot {
        display: block;
        background: var(--white);
        border-radius: var(--radius-lg);
        padding: 16px;
        box-shadow: var(--shadow-sm);
        margin-top: 8px;
    }

    .table-responsive tfoot tr {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }

    .table-responsive tfoot td {
        display: block;
        flex: 1 1 auto;
    }

    /* Login page */
    .login-card {
        padding: 24px 20px 20px;
    }

    .login-title {
        font-size: 1.625rem;
    }

    .login-logo {
        width: 60px;
        height: 60px;
    }

    /* Form rows become single column */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Modal */
    .modal-box {
        padding: 28px 20px;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-message {
        font-size: 1rem;
    }

    /* Notification */
    #notification-container {
        top: calc(var(--nav-height) + 12px);
        right: 12px;
        left: 12px;
        max-width: none;
        width: auto;
    }

    .notification {
        min-width: auto;
        font-size: 16px;
    }

    /* Search bar */
    .search-bar {
        flex-direction: column;
    }

    .search-input-wrapper {
        width: 100%;
    }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (<=480px)
   ============================================================ */

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .navbar {
        padding: 0 14px;
    }

    .navbar-brand {
        font-size: 18px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 15px;
    }

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

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    h1 { font-size: 1.625rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.125rem; }

    .summary-card-number {
        font-size: 1.75rem;
    }

    .page-title {
        font-size: 1.375rem;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .navbar,
    .hamburger,
    .btn,
    .modal-overlay,
    .notification,
    #notification-container {
        display: none !important;
    }

    .page-content {
        max-width: none;
        padding: 0;
    }

    body {
        background: white;
        color: black;
    }

    .card, .table-responsive {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ============================================================
   DASHBOARD CARDS
   ============================================================ */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.card-lilac {
    border-left: 4px solid var(--primary);
}

.card-red {
    border-left: 4px solid var(--danger);
}

.card-green {
    border-left: 4px solid var(--success);
}

.summary-card-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.summary-card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.summary-card-label {
    font-size: 15px;
    color: var(--text-light);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
}

/* ============================================================
   CARD HEADER / FOOTER
   ============================================================ */
.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--primary-lighter);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.card-header .card-title {
    margin: 0;
    font-size: 18px;
    color: var(--primary-dark);
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: #f9fafb;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============================================================
   STOCK ALARM BADGE (inline)
   ============================================================ */
.stock-alarm {
    color: var(--danger);
    font-weight: 700;
    font-size: 18px;
}

/* ============================================================
   ROW DANGER (low stock highlight)
   ============================================================ */
.row-danger {
    background-color: #fef2f2 !important;
}

.row-danger:hover {
    background-color: #fee2e2 !important;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge-primary {
    background-color: var(--primary);
    color: var(--white);
}

.badge-info {
    background-color: #6366f1;
    color: var(--white);
}

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

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

/* ============================================================
   ACTION BUTTONS
   ============================================================ */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   PRODUCT THUMBNAIL
   ============================================================ */
.product-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.product-thumb-placeholder {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-lighter);
    border-radius: var(--radius-sm);
    font-size: 28px;
}

/* ============================================================
   CATEGORY TREE
   ============================================================ */
.category-tree {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    transition: background var(--transition);
}

.category-item:hover {
    background: var(--primary-lighter);
}

.category-parent {
    font-weight: 600;
    font-size: 17px;
    background: #f3f0ff;
}

.category-child {
    padding-left: 40px;
    font-size: 16px;
    color: var(--text);
}

.category-name {
    flex: 1;
}

.category-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================
   SALE PAGE LAYOUT
   ============================================================ */
.sale-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .sale-layout {
        grid-template-columns: 1fr;
    }
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.product-card {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
    text-align: center;
}

.product-card:hover:not(.out-of-stock) {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.product-card.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
}

.product-card-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.product-card-img-placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-lighter);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    font-size: 40px;
}

.product-card-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
}

.product-card-stock {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Cart */
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    font-size: 13px;
    color: var(--text-light);
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item-qty {
    font-weight: 700;
    font-size: 18px;
    min-width: 28px;
    text-align: center;
}

.cart-item-total {
    font-weight: 700;
    font-size: 16px;
    min-width: 80px;
    text-align: right;
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.cart-item-remove:hover {
    background: #fef2f2;
}

/* ============================================================
   REPORT STYLES
   ============================================================ */
.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.sale-detail-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
}

.sale-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #f9fafb;
    cursor: pointer;
    transition: background var(--transition);
    flex-wrap: wrap;
    gap: 8px;
}

.sale-detail-header:hover {
    background: var(--primary-lighter);
}

.sale-detail-toggle {
    display: inline-block;
    margin-left: 8px;
    transition: transform var(--transition);
}

.sale-detail-body {
    padding: 0 20px 16px;
}

/* ============================================================
   FORM ACTIONS
   ============================================================ */
.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .btn {
        width: 100%;
        text-align: center;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .sale-layout {
        grid-template-columns: 1fr;
    }

    .cart-item {
        flex-wrap: wrap;
    }

    .filter-buttons {
        flex-direction: column;
    }

    .filter-buttons .btn {
        width: 100%;
        text-align: center;
    }

    .category-child {
        padding-left: 24px;
    }
}
