/* Modern Warehouse Management System Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background-color: #f8fafc;
    color: #1f2937;
}

/* Layout & Header */
.warehouse-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header layout helpers */
.logo{ pointer-events:none; }
.logo img, .logo .company-logo{ pointer-events:none; }
.user-menu{ position:relative; z-index:10; }

.warehouse-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Company logo placeholder */
.company-logo{border:1px solid #e5e7eb}
[data-theme="dark"] .company-logo{border-color:#1f2937}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

/* Navigation Tabs */
.warehouse-navigation {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 2rem;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 0;
}

.nav-tab {
    padding: 1rem 1.5rem;
    border: none;
    background: none;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-tab:hover {
    color: #374151;
    background-color: #f9fafb;
}

.nav-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    background-color: #f8fafc;
}

/* Content Area */
.content-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* Cards & Grid Layouts */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.card-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-body {
    margin-bottom: 1rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

/* Theme Toggle (front-end) */
.theme-toggle{position:fixed;top:12px;right:12px;z-index:1000;background:#fff;border:1px solid #e5e7eb;border-radius:10px;padding:.5rem;box-shadow:0 8px 20px rgba(2,6,23,.08);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;width:auto;height:auto;line-height:0}
.theme-toggle:hover{background:#f9fafb}
[data-theme="dark"] .theme-toggle{background:#0b1220;border-color:#1f2937}

/* Language switcher (beside theme toggle) */
.lang-switcher .btn{padding:6px 10px; border-radius:10px}
.lang-switcher .lang-menu{background:#fff}
[data-theme="dark"] .lang-switcher .lang-menu{background:#0f172a; border-color:#1f2937}
.lang-switcher .lang-item:hover{background:#f3f4f6}
[data-theme="dark"] .lang-switcher .lang-item:hover{background:#111827}

.btn-primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-secondary {
    background: white;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-success {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

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

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-row .form-group:first-child {
    flex: 0 0 100px;
}

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

.form-color {
    width: 100%;
    height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
    box-sizing: border-box;
}

.form-row .form-label {
    white-space: nowrap;
}

/* Search & Filters */
.search-filters {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.search-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.search-input input {
    padding-left: 2.5rem;
}

/* Modals */
.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;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal--md { max-width: 540px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 960px; }

.modal input,
.modal textarea,
.modal select {
    background: white;
    color: #111827;
    border: 1px solid #d1d5db;
    width: 100%;
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    box-sizing: border-box;
}

.modal .modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal table.modal-form {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.modal table.modal-form > tbody > tr > td {
    width: 100%;
    display: block;
    padding: 8px 0;
}

.modal .modal-form .form-group {
    margin-bottom: 0;
}

.modal .modal-form .two-col .form-group {
    margin-bottom: 0;
}

.modal label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #6b7280;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
}

.two-col .form-group {
    margin-bottom: 0;
}

/* Tree Views */
.tree-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.tree-row {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.tree-row:hover {
    background-color: #f9fafb;
}

.tree-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.tree-toggle,
.tree-toggle--spacer {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: calc(var(--tree-level, 0) * 1.5rem);
}

.tree-toggle:hover {
    background: #f3f4f6;
    color: #374151;
}

.tree-toggle.expanded i {
    transform: rotate(180deg);
}

.tree-toggle--spacer {
    pointer-events: none;
}

.tree-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    background: var(--tree-icon-color, #3b82f6);
}

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

.tree-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tree-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.tree-name:hover {
    text-decoration: underline;
}

.tree-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
}

.tree-chip--count {
    background: #ecfdf5;
    color: #047857;
    cursor: pointer;
}

.tree-chip--sub {
    background: #e0e7ff;
    color: #3730a3;
}

.tree-chip--code {
    background: #e2e8f0;
    color: #475569;
    font-family: monospace;
}

.tree-chip--type {
    background: #dbeafe;
    color: #1d4ed8;
}

.tree-path {
    color: #6b7280;
    font-size: 13px;
    margin-top: 4px;
}

.tree-description {
    color: #6b7280;
    font-size: 13px;
    margin-top: 4px;
    line-height: 1.4;
}

.tree-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.tree-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.tree-children.expanded {
    max-height: 1000px;
}

.categories-container,
.locations-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.categories-tree,
.locations-tree {
    max-height: 70vh;
    overflow-y: auto;
}

.sale-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.sale-summary__title {
    margin: 0 0 0.25rem 0;
    font-weight: 600;
    color: #111827;
}

.sale-summary__meta {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
}

.credentials-card {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.credentials-field {
    margin: 0 0 0.75rem 0;
    font-weight: 600;
    color: #374151;
}

.credentials-password {
    font-family: monospace;
    background: #e2e8f0;
    color: #111827;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    word-break: break-all;
    border: 1px solid #cbd5e1;
    margin-bottom: 0.75rem;
}

.credentials-hint {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
}

.stat-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}

.table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.table tr:hover {
    background-color: #f9fafb;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* Lot Price Calculations */
.lot-price-section {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.lot-price-container input {
    background: white;
}

.lot-price-help {
    color: #6b7280;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: block;
}

.lot-calculations {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.calc-row.total-row {
    border-top: 1px solid #e5e7eb;
    padding-top: 0.5rem;
    font-weight: 600;
}

.calc-label {
    color: #6b7280;
}

.calc-value {
    color: #1f2937;
    font-weight: 500;
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .content-container {
        padding: 1rem;
    }
    
    .search-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-row > * {
        width: 100%;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .nav-container {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Color Picker Input */
input[type="color"] {
    width: 40px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
}

/* Icon Dropdown */
.icon-dropdown {
    position: relative;
}

.icon-dropdown-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    width: 100%;
    justify-content: space-between;
}

.icon-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
}

.icon-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.icon-option:hover {
    background: #f3f4f6;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.hidden { display: none; }
.block { display: block; }

.logo img.custom-logo{height:36px;width:auto;border-radius:8px}
