/* Custom Styles for Warehouse Manager */

:root {
    --primary: #0d6efd;
    --secondary: #6c757d;
    --success: #198754;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #0dcaf0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #404040 0%, #CEBFA6 100%);
    min-height: 100vh;
}

.login-page .card {
    border: none;
    border-radius: 1rem;
}

.login-page .btn {
    min-height: 48px;
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

/* Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.nav-link {
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    opacity: 0.8;
}

.navbar .btn {
    min-height: 44px;
}

/* Cards */
.stat-card {
    border-left: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

/* Item Cards */
.item-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.item-card img {
    height: 200px;
    object-fit: cover;
}

/* Item Card Badges */
.item-card .badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}

.item-card .card-img-top {
    position: relative;
    background-size: cover;
    background-position: center;
}

/* Item Card Buttons - Mobile First */
.item-card-btn {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    min-height: 48px;
    font-weight: 500;
}

/* Photo Upload */
.photo-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-upload-area:hover {
    border-color: var(--primary);
    background-color: rgba(13, 110, 253, 0.05);
}

.photo-upload-area.dragover {
    border-color: var(--success);
    background-color: rgba(25, 135, 84, 0.1);
}

.photo-preview {
    position: relative;
    display: inline-block;
    margin: 0.5rem;
}

.photo-preview img {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
}

.photo-preview .remove-photo {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Camera Capture */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.camera-container video {
    width: 100%;
    border-radius: 0.5rem;
}

.camera-controls {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Search and Filters */
.filter-bar {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

/* Form Controls - Mobile First */
.form-control,
.form-select {
    min-height: 44px;
    font-size: 1rem;
    padding: 0.65rem 0.75rem;
}

/* Tables */
.table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background-color: #f8f9fa;
}

/* Buttons - Mobile First Design */
.btn {
    transition: all 0.2s ease;
    min-height: 44px;
    padding: 0.65rem 1rem;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
}

/* Small buttons for table actions */
.btn-sm {
    min-height: 36px;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
}

.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Status Badges */
.status-in {
    background-color: var(--success);
}

.status-out {
    background-color: var(--secondary);
}

/* Modal */
.modal-header {
    background-color: var(--primary);
    color: white;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Modal Footer Buttons */
.modal-footer .w-100.d-flex > button {
    flex: 1 1 0;
    min-width: 0;
    width: 50%;
    max-width: 50%;
}

.modal-footer .btn {
    min-height: 48px;
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

/* Desktop navbar icon spacing */
.navbar-nav .nav-link i {
    margin-right: 0.5rem;
}

.navbar-nav .btn i,
.navbar-collapse .d-flex .btn i,
.navbar-collapse .d-flex span i {
    margin-right: 0.5rem;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }

    /* Touch-friendly navbar buttons */
    .navbar-nav .nav-link {
        font-size: 1.1rem;
        padding: 0.75rem 1rem;
        margin: 0.25rem 0;
    }

    .navbar-nav .nav-link i {
        margin-right: 0.75rem;
    }

    .navbar-nav .btn {
        font-size: 1rem;
        padding: 0.65rem 1.25rem;
        margin: 1rem 0 0.5rem 0;
        min-height: 44px;
    }

    .navbar-nav .btn i,
    .navbar-collapse .d-flex .btn i,
    .navbar-collapse .d-flex span i {
        margin-right: 0.5rem;
    }

    .navbar-collapse {
        padding: 0.5rem 0;
    }

    .navbar-nav {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .navbar-collapse .d-flex {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    /* Optimize stat cards for mobile */
    .stat-card {
        margin-bottom: 1rem;
    }

    .stat-card .card-body {
        padding: 0.75rem 1rem;
    }

    .stat-card h6 {
        font-size: 0.85rem;
        margin-bottom: 0.35rem;
    }

    .stat-card h2 {
        font-size: 1.75rem;
        margin-bottom: 0.25rem;
    }

    .stat-card small {
        font-size: 0.75rem;
    }

    .stat-card .stat-icon {
        font-size: 2rem;
    }

    .item-card img {
        height: 150px;
    }

    .table {
        font-size: 0.875rem;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }

    .filter-bar {
        padding: 0.75rem;
    }

    .photo-preview img {
        width: 120px;
        height: 120px;
    }

    /* Make modal-xl responsive on mobile */
    .modal-dialog.modal-xl {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    /* Ensure table-responsive allows horizontal scrolling */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }

    /* Stack header buttons vertically on mobile */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem;
    }

    .d-flex.justify-content-between.align-items-center h2,
    .d-flex.justify-content-between.align-items-center h4 {
        margin-bottom: 0.5rem;
    }

    .d-flex.justify-content-between.align-items-center .d-flex {
        width: 100%;
    }

    .d-flex.justify-content-between.align-items-center .btn {
        flex: 1;
    }

    /* Make badges and action buttons touch-friendly on mobile tables */
    .table .badge {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    .table .btn-group {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.25rem;
    }

    /* Product Details Modal - Mobile Optimized */
    .modal-body h6 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    .modal-body p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    .modal-body .badge {
        font-size: 0.8rem !important;
        padding: 0.4em 0.6em;
    }

    /* Improve modal body scrolling on mobile */
    .modal-body {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }

    /* Reduce badge sizes on mobile for better fit */
    .modal-body .badge {
        font-size: 0.75rem !important;
        padding: 0.35em 0.5em;
    }

    /* Make modal footer buttons stack vertically on mobile */
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .w-100 {
        order: -1; /* Put Add/Remove buttons first */
    }

    .modal-footer > button:not(.w-100 button) {
        width: 100%;
    }

    /* Compact table for better mobile viewing */
    .table td, .table th {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }

    /* Make admin table buttons more touch-friendly */
    .table .btn-sm {
        min-height: 40px;
        min-width: 40px;
        padding: 0.5rem;
        font-size: 1rem;
    }

    .table .btn-sm i {
        font-size: 1.1rem;
    }

    /* Add spacing between action buttons */
    .table td button {
        margin-bottom: 0.25rem;
    }

    /* Admin nav tabs touch-friendly */
    .nav-tabs .nav-link {
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    /* Adjust main content padding on mobile */
    .main-content {
        padding: 1rem 0.5rem;
    }

    /* Make card bodies more compact on mobile */
    .card-body {
        padding: 1rem;
    }

    /* Prevent horizontal scroll on body */
    body {
        overflow-x: hidden;
    }

    /* Ensure modals don't cause horizontal scroll */
    .modal {
        padding-right: 0 !important;
    }

    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}
/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.timeline-item {
    position: relative;
    padding-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.44rem;
    top: 0.25rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .filter-bar {
        display: none !important;
    }

    .card {
        break-inside: avoid;
    }
}

/* Primary Photo Styling */
.photo-preview.primary-photo {
    border: 3px solid #ffc107;
    position: relative;
}

.photo-preview .set-primary-btn {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #ffc107;
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.photo-preview .set-primary-btn:hover {
    background: #ffb300;
    transform: scale(1.1);
}

.photo-preview .primary-badge {
    position: absolute;
    top: -10px;
    left: -10px;
    background: #ffc107;
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.item-card .card-img-top {
    position: relative;
    overflow: hidden;
}

.item-card .card-img-top i {
    position: relative;
    z-index: 1;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
    animation: zoomIn 0.2s ease-out;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: transparent;
    border: none;
    color: white;
    font-size: 48px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    transform: scale(1.2);
    opacity: 0.8;
}

@media (max-width: 768px) {
    .lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        border-radius: 50%;
        font-size: 36px;
        width: 44px;
        height: 44px;
    }

    .lightbox-content img {
        max-height: 85vh;
    }
}

/* Footer */
.app-footer {
    background-color: #11111F;
    border-top: 1px solid #dee2e6;
    padding: 2rem 0;
    margin-top: auto;
}

.app-footer p {
    color: white;
}

.footer-logo {
    max-width: 200px;
    height: auto;
    border-radius: 10px;
}

.footer-link {
    color: #41B6E6;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.footer-link:hover {
    color: #5fc9f5;
    text-decoration: underline;
}

.footer-link i {
    margin-right: 0.5rem;
}

@media (max-width: 768px) {
    .app-footer {
        padding: 1.5rem 0;
    }

    .footer-logo {
        max-width: 150px;
    }
}
