/* Custom Styles for Flash Inventory System */

/* Additional custom styles can be added here */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Image Display with Aspect Ratio */
.image-container {
    display: inline-block;
    width: 100%;
}

.image-container img {
    display: block;
    max-width: 100%;
    height: auto;
    aspect-ratio: auto;
}

/* Image Modal Styles */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: auto;
    animation: fadeIn 0.3s;
}

.image-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
    animation: zoomIn 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-modal-content img {
    width: 100%;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
    cursor: grab;
}

.image-modal-content img:active {
    cursor: grabbing;
}

.image-modal-content img.zoomed {
    cursor: move;
}

.image-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10000;
    background-color: rgba(0, 0, 0, 0.5);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
}

.image-modal-close:hover,
.image-modal-close:focus {
    color: #fff;
    background-color: rgba(0, 0, 0, 0.8);
}

.image-modal-caption {
    margin-top: 20px;
    color: #fff;
    text-align: center;
    font-size: 16px;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    max-width: 100%;
}

/* Zoom Controls */
.image-modal-controls {
    position: absolute;
    top: -50px;
    left: 0;
    display: flex;
    gap: 10px;
    z-index: 10000;
}

.image-modal-control-btn {
    width: 45px;
    height: 45px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background-color 0.3s;
    line-height: 1;
}

.image-modal-control-btn:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.image-modal-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Zoom level indicators */
.image-zoom-info {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .image-modal-content {
        max-width: 95%;
        max-height: 85%;
    }
    
    .image-modal-close {
        top: -45px;
        font-size: 35px;
        width: 40px;
        height: 40px;
    }
    
    .image-modal-caption {
        margin-top: 15px;
        font-size: 14px;
        padding: 8px 16px;
    }
    
    .image-modal-controls {
        top: -45px;
    }
    
    .image-modal-control-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .image-zoom-info {
        top: -45px;
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* Sidebar Collapsed State */
.sidebar-collapsed .menu-text {
    display: none;
}

/* Tooltip for collapsed sidebar icons - only show for items with title attribute (items without sub-menus) */
aside nav > ul > li > a[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    margin-left: 10px;
    padding: 6px 12px;
    background-color: #1f2937;
    color: white;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 1000;
    font-size: 14px;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Ensure tooltips don't show for items with sub-menus (they don't have title attribute anymore) */
aside nav > ul > li.relative > a[title]::after {
    display: none !important;
}

/* Floating sub-menu styling when sidebar is collapsed */
aside.w-20 ul ul {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ensure sub-menus stay visible when hovering over them */
aside.w-20 li:hover > ul {
    display: block !important;
}

/* Nested sub-menu (sub-menu of sub-menu) positioning when sidebar is collapsed */
aside.w-20 ul ul li.relative {
    position: relative;
}

/* Ensure nested sub-menus appear correctly when parent is a floating menu */
aside.w-20 ul ul li.relative > ul {
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 0.5rem;
    z-index: 60;
    min-width: 220px;
}

/* Make sure nested sub-menus are visible and properly positioned */
aside.w-20 ul ul li.relative:hover > ul {
    display: block !important;
}

/* Prevent parent floating sub-menus from clipping nested sub-menus */
aside.w-20 ul ul.absolute {
    overflow: visible !important;
}

/* Ensure nested sub-menu items are properly styled */
aside.w-20 ul ul li.relative > ul li a {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Sub-menu header styling when sidebar is collapsed - prominent header */
aside.w-20 ul ul li.bg-gray-700 {
    margin: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sub-menu header text - make it prominent */
aside.w-20 ul ul li.bg-gray-700 span {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.025em;
}

/* Sub-menu items container - add padding when header is present */
aside.w-20 ul ul {
    padding-top: 0;
    padding-bottom: 0.5rem;
}

/* Ensure sub-menu items have proper spacing */
aside.w-20 ul ul li:not(.bg-gray-700) {
    margin-top: 0.125rem;
    margin-bottom: 0.125rem;
}

/* Sub-menu items padding adjustment when collapsed */
aside.w-20 ul ul li:not(.bg-gray-700) a {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Mobile responsive sidebar */
@media (max-width: 1023px) {
    /* On mobile, sidebar is always hidden by default and shown via toggle */
    aside {
        transform: translateX(-100%);
    }
    
    aside.translate-x-0 {
        transform: translateX(0);
    }
}

/* Sidebar Layout Fixes */
aside {
    flex-shrink: 0;
}

/* Ensure main content adjusts properly - no extra margin since sidebar is in flex flow */
main {
    min-width: 0;
    flex: 1 1 0%;
    margin-left: 0 !important;
}

/* On desktop, sidebar is static so it's part of flex layout - no margin needed */
@media (min-width: 1024px) {
    main {
        margin-left: 0 !important;
    }
}

/* Center menu items when sidebar is collapsed */
aside.w-20 nav ul li > a {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

/* Hide text when sidebar is collapsed */
aside.w-20 nav ul li > a span {
    display: none !important;
}

/* Show icons centered when collapsed */
aside.w-20 nav ul li > a svg {
    margin: 0 !important;
}

/* Mobile: ensure main content is full width when sidebar is hidden */
@media (max-width: 1023px) {
    main {
        width: 100%;
        margin-left: 0 !important;
    }
}

