/* ============================================
   CSS chung cho ứng dụng quản lý kho
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    background: #f9fafb;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    display: flex;
    gap: 0;
    width: 100%;
    height: 100vh;
    background: #ffffff;
}

/* ============================================
   Menu Panel
   ============================================ */

.menu-panel {
    width: 380px;
    background: #ffffff;
    padding: 0;
    overflow: hidden;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: row;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 0 0 rgba(0,0,0,0);
}

/* Vertical Navigation */
.vertical-nav {
    width: 64px;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
    flex-shrink: 0;
}

.nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    padding: 0;
}

.nav-icon:hover {
    background: #e5e7eb;
    color: #111827;
}

.nav-icon.active {
    background: #ef4444;
    color: white;
}

.nav-icon svg {
    width: 20px;
    height: 20px;
}

/* Menu Content */
.menu-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.menu-panel.menu-hidden {
    width: 0;
    padding: 0;
    border-right: none;
    overflow: hidden;
}

.menu-panel.menu-hidden .vertical-nav,
.menu-panel.menu-hidden .menu-content {
    display: none;
}

/* Menu Content */
.menu-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Menu Header */
.menu-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.menu-header h1 {
    color: #111827;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    border: none;
    text-transform: none;
    letter-spacing: 0;
}

.menu-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.menu-close-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.menu-close-btn svg {
    width: 18px;
    height: 18px;
}

/* Search Section */
.search-section {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fafb;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #ef4444;
    background: white;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.search-box input::placeholder {
    color: #9ca3af;
}

/* Stats Section */
.stats-section {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex-shrink: 0;
}

.stat-card {
    background: #f9fafb;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.stat-label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

/* Menu Actions */
.menu-actions {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
}

/* Filter Section */
.filter-section {
    padding: 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex-shrink: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.filter-group select {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #f9fafb;
    color: #111827;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #ef4444;
    background: white;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.warehouse-location {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    font-style: italic;
}

/* Warehouse Section */
.warehouse-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.warehouse-section-title {
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.warehouse-section-title svg {
    color: #ef4444;
}


.btn-login-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: #ef4444;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-login-link:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-login-link svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    width: 100%;
    padding: 10px 16px;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-danger {
    background: #ef4444;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
    margin: 0;
    font-weight: 500;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.5);
}

/* ============================================
   Warehouse List
   ============================================ */

.warehouse-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    background: #ffffff;
    min-height: 0;
}

.warehouse-item {
    padding: 14px 16px;
    margin-bottom: 8px;
    background: white;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.warehouse-item:hover {
    border-color: #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
    transform: translateY(-1px);
}

.warehouse-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ef4444;
    flex-shrink: 0;
}

.warehouse-info {
    flex: 1;
}

.warehouse-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.warehouse-name {
    font-weight: 500;
    color: #111827;
    font-size: 14px;
    transition: color 0.2s ease;
    flex: 1;
}

.warehouse-name:hover {
    color: #ef4444;
}

.warehouse-details {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.warehouse-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================
   Menu Toggle
   ============================================ */

.menu-toggle {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 10px;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.menu-toggle:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.menu-toggle svg {
    width: 20px;
    height: 20px;
    stroke: #374151;
}

/* Chỉ hiển thị nút mở menu khi menu đang ẩn */
.menu-panel.menu-hidden ~ .map-container .menu-toggle {
    display: flex;
    left: 16px;
}

/* Ẩn nút mở menu khi menu đang hiện */
.menu-panel:not(.menu-hidden) ~ .map-container .menu-toggle {
    display: none;
}

/* Mobile Search Bar - Ẩn trên desktop */
.mobile-search-bar {
    display: none;
}

/* ============================================
   Map Container
   ============================================ */

.map-container {
    flex: 1;
    background: white;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#map {
    height: 100%;
    width: 100%;
    border-radius: 0;
}

/* Zoom Control - Góc dưới bên phải */
.leaflet-control-zoom {
    margin: 0 !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    background: white !important;
    color: #374151 !important;
    border: 1px solid #e5e7eb !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:hover {
    background: #f9fafb !important;
    color: #111827 !important;
}

.leaflet-control-zoom-in {
    border-bottom: 1px solid #e5e7eb !important;
    border-radius: 12px 12px 0 0 !important;
}

.leaflet-control-zoom-out {
    border-radius: 0 0 12px 12px !important;
}

/* ============================================
   Modal
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    margin: 8% auto;
    padding: 30px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e6ed;
}

.modal-header h2 {
    color: #2d3748;
    font-size: 22px;
    font-weight: 700;
}

.close {
    color: #a0aec0;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: #2d3748;
    background: #f7fafc;
    transform: rotate(90deg);
}

/* ============================================
   Form Elements
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e6ed;
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: #f7fafc;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #ef4444;
    background: white;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-group input::placeholder {
    color: #a0aec0;
}

/* ============================================
   Login Form
   ============================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    animation: slideDown 0.5s ease;
}

.login-box h1 {
    text-align: center;
    color: #2d3748;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 700;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .btn {
    margin-top: 10px;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #c33;
    font-size: 14px;
}

.success-message {
    background: #efe;
    color: #3c3;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3c3;
    font-size: 14px;
}

/* ============================================
   Admin Container
   ============================================ */

.admin-container {
    min-height: 100vh;
    background: #f9fafb;
    display: flex;
}

.admin-sidebar {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.admin-user-info {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
}

.admin-user-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 12px;
}

.admin-actions {
    display: flex;
    gap: 10px;
}

.admin-actions .btn {
    width: auto;
    padding: 8px 16px;
    font-size: 13px;
}

.admin-content {
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.admin-header-section {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.admin-header-section h1 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

/* ============================================
   Read-only Badge
   ============================================ */

.read-only-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1001;
    background: rgba(255, 193, 7, 0.95);
    color: #856404;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.read-only-badge::before {
    content: "👁️";
    font-size: 14px;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    body {
        overflow: hidden;
    }

    .container {
        flex-direction: row;
        height: 100vh;
    }

    .menu-panel {
        display: none !important;
    }
    
    .map-container {
        flex: 1;
        width: 100%;
        position: relative;
    }

    .menu-toggle {
        display: none !important;
    }

    /* Mobile Search Bar - Hiển thị trên mobile */
    .mobile-search-bar {
        display: block;
        position: absolute;
        top: 16px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: 500px;
        z-index: 1001;
    }

    .search-box-mobile {
        position: relative;
        display: flex;
        align-items: center;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        padding: 0;
        overflow: hidden;
    }

    .search-box-mobile svg {
        position: absolute;
        left: 16px;
        color: #9ca3af;
        pointer-events: none;
        z-index: 1;
    }

    .search-box-mobile input {
        width: 100%;
        padding: 14px 16px 14px 48px;
        border: none;
        border-radius: 12px;
        font-size: 16px;
        background: white;
        outline: none;
    }

    .search-box-mobile input::placeholder {
        color: #9ca3af;
    }

    /* Mobile Layer Control */
    .mobile-layer-control {
        margin-top: 80px !important;
    }

    .mobile-layer-control .leaflet-control-layers-toggle {
        width: 44px;
        height: 44px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }

    .leaflet-control-layers {
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border: none;
    }

    .leaflet-control-layers-list {
        padding: 8px;
    }

    .leaflet-control-layers-list label {
        padding: 10px 12px;
        border-radius: 8px;
        margin: 4px 0;
        cursor: pointer;
        transition: background 0.2s;
    }

    .leaflet-control-layers-list label:hover {
        background: #f3f4f6;
    }

    .modal-content {
        margin: 15% auto;
        padding: 20px;
        width: 95%;
    }

    .login-box {
        padding: 30px 20px;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

/* Scrollbar mặc định cho warehouse-list */
.warehouse-list {
    scrollbar-width: thin;
    scrollbar-color: auto;
}

.menu-panel::-webkit-scrollbar {
    width: 8px;
}

.menu-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.menu-panel::-webkit-scrollbar-thumb {
    background: #ef4444;
    border-radius: 10px;
}

.menu-panel::-webkit-scrollbar-thumb:hover {
    background: #dc2626;
}

