/* DropCabinet Styles */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f1f5f9;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-manager {
    background: #f0f9ff;
    border-bottom: 2px solid var(--primary);
}

.navbar-admin {
    background: #fff1f2;
    border-bottom: 2px solid var(--danger);
}

.navbar-brand a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: var(--gray);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--light);
    color: var(--primary);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar.search-bar {
    padding: 0.5rem 2rem;
    box-shadow: none;
    justify-content: center;
}

.user-name {
    font-weight: 500;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin {
    background: #fef3c7;
    color: #92400e;
}

.badge-manager {
    background: #dbeafe;
    color: #1e40af;
}

.badge-client {
    background: #d1fae5;
    color: #065f46;
}

.badge-primary {
    background: var(--primary);
    color: var(--white);
}

/* Status badges */
.status-новий {
    background: #dbeafe;
    color: #1e40af;
}

.status-в-обробці {
    background: #fef3c7;
    color: #92400e;
}

.status-відправлено {
    background: #d1fae5;
    color: #065f46;
}

.status-виконано {
    background: #e2e8f0;
    color: #475569;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
}

.table tr:hover {
    background: #f8fafc;
}

/* Grid */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Layout */
.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray);
}

/* Sidebar */
.layout-with-sidebar {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: calc(100vh - 120px);
}

.sidebar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar-title {
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Category Tree */
.category-tree {
    list-style: none;
}

.category-tree li {
    margin: 0.25rem 0;
}

.category-tree a {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--dark);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.category-tree a:hover,
.category-tree a.active {
    background: var(--light);
    color: var(--primary);
}

.category-tree .children {
    margin-left: 1.5rem;
}

.category-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 0.5rem;
    background: #f8f8f8;
    border: 1px solid var(--border);
}

/* Product Cards */
.product-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
    border-color: rgba(99, 102, 241, 0.35);
}

.product-card img.product-image {
    width: 100%;
    height: 180px;
    object-fit: contain;
    background: #f8f8f8;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
}

.product-name {
    font-weight: 700;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-article {
    color: #4338ca;
    font-size: 0.85rem;
    background: #eef2ff;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    display: inline-flex;
    width: fit-content;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--gray);
}

.badge-stock {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: #ecfdf3;
    color: #15803d;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid #bbf7d0;
}

.price-block {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
}

.subcategory-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.subcategory-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

.subcategory-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 10px;
    background: #f8f8f8;
    border: 1px solid var(--border);
}

.subcategory-title {
    font-weight: 600;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
}

.pagination .btn {
    min-width: 38px;
    justify-content: center;
}

.pagination-ellipsis {
    padding: 0 0.25rem;
    color: var(--gray);
}

/* Mobile-first list cards (admin/manager lists) */
.data-cards {
    display: grid;
    gap: 0.75rem;
}

.data-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    padding: 1rem;
}

.data-card-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.5rem;
}

.data-card-label {
    color: var(--gray);
    font-size: 0.85rem;
}

.data-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* Cart */
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-input {
    width: 60px;
    text-align: center;
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
}

/* Search */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Filters */
.filter-group {
    margin-bottom: 1.5rem;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray);
    text-transform: uppercase;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    cursor: pointer;
}

.filter-option input {
    width: 18px;
    height: 18px;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light);
    border-radius: var(--radius);
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-input {
    width: 60px;
    text-align: center;
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
}

/* Search */
.search-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Filters */
.filter-group {
    margin-bottom: 1.5rem;
}

.filter-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray);
    text-transform: uppercase;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    cursor: pointer;
}

.filter-option input {
    width: 18px;
    height: 18px;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s;
        border-radius: 0;
        max-height: 100vh;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .navbar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }

    .navbar-menu {
        order: 3;
        width: 100%;
        margin-top: 1rem;
        justify-content: center;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .navbar-user {
        gap: 0.5rem;
    }

    .user-name {
        display: none;
    }

    /* Cart Mobile */
    .cart-item {
        grid-template-columns: 80px 1fr;
        gap: 0.75rem;
    }

    .cart-item-actions {
        grid-column: 1 / -1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-top: 1px solid var(--border);
        padding-top: 0.75rem;
        margin-top: 0.5rem;
    }

    .cart-item-info input {
        max-width: 100% !important;
    }

    /* Table Responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .container {
        padding: 1rem;
    }

    .modal {
        max-width: calc(100% - 1rem);
        max-height: 92vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Mobile Filter Toggle Button */
.mobile-filter-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        margin-bottom: 1rem;
        justify-content: center;
    }
}
