/* Reset & base layout */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100%;
    overflow-x: hidden;
    font-family: sans-serif;
    background-color: #f9f9f9;
    color: #333;
}

/* Center the main container and make it responsive */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Scanner section */
.scanner-box {
    background-color: #fff;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

    /* Headline and message */
    .scanner-box h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .scanner-box p {
        font-size: 1rem;
        line-height: 1.5;
    }

/* Media queries for mobile */
@media (max-width: 600px) {
    .scanner-box {
        padding: 1rem;
    }

        .scanner-box h1 {
            font-size: 1.4rem;
        }

        .scanner-box p {
            font-size: 0.95rem;
        }
}


/* Original Code below */

@media (min-width: 500px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: #1a1a1a;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.main-container {
    flex: 1 0 auto;
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 20px;
}

    .sidebar-header h3 {
        color: white;
        margin: 0;
        font-weight: 600;
        font-size: 1.1rem;
    }

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    color: white;
}

    .sidebar-nav li {
        color: white;
        margin: 0;
    }

    .sidebar-nav a {
        display: flex;
        align-items: center;
        padding: 15px 25px;
        color: white;
        text-decoration: none;
        transition: all 0.3s ease;
        border-left: 3px solid transparent;
    }

        .sidebar-nav a:hover,
        .sidebar-nav a.active {
            background-color: rgba(255,255,255,0.1);
            border-left-color: white;
            color: white;
        }

    .sidebar-nav i {
        margin-right: 12px;
        font-size: 1.1rem;
        width: 20px;
        text-align: center;
    }

.content-area {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
    background-color: #1a1a1a;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.search-container {
    background-color: #2d2d2d;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

    .search-container h2 {
        color: #ff6b6b;
        margin-bottom: 20px;
        font-weight: 600;
    }

.search-form {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #444;
    border-radius: 8px;
    background-color: #3a3a3a;
    color: white;
    font-size: 16px;
}

    .search-input:focus {
        outline: none;
        border-color: #ff6b6b;
        box-shadow: 0 0 0 0.2rem rgba(255, 107, 107, 0.25);
    }

.search-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .search-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    }

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.product-card {
    background-color: #2d2d2d;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: 1px solid #444;
    cursor: pointer;
}

    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.4);
        border-color: #ff6b6b;
    }

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
    background-color: #3a3a3a;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-brand {
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ff6b6b;
    margin-bottom: 8px;
}

.product-details {
    color: #aaa;
    font-size: 0.85rem;
}

.price-row {
    display: flex;
    gap: 1rem; /* optional spacing between prices */
    justify-content: space-between; /* adjust as needed */
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #ccc;
}

    .no-results i {
        font-size: 4rem;
        color: #555;
        margin-bottom: 20px;
    }

/* Bottom Navigation - hidden by default, shown on mobile */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    z-index: 1001;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 8px;
    margin: 0 5px;
}

.bottom-nav-btn:hover,
.bottom-nav-btn.active {
    background-color: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

.bottom-nav-btn i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.bottom-nav-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .content-area {
        margin-left: 0;
        padding: 10px;
        padding-bottom: 80px;
    }

    .bottom-nav {
        display: flex;
    }

    .footer {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        margin: 0;
        z-index: 1000;
    }

    .search-results-container {
        padding-bottom: 80px;
    }

    .search-container {
        padding: 15px;
        margin-bottom: 15px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .product-card {
        padding: 15px;
    }

    .search-form {
        flex-direction: column;
        gap: 10px;
    }

    .sidebar-header h3 {
        font-size: 1rem;
    }

    #qr-reader {
        width: 100% !important;
        max-width: 300px !important;
        margin: 0 auto;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .content-area {
        margin-left: 0;
        padding: 15px;
        padding-bottom: 80px;
    }

    .bottom-nav {
        display: flex;
    }

    .footer {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        margin: 0;
        z-index: 1000;
    }

    .search-results-container {
        padding-bottom: 80px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .search-form {
        flex-direction: column;
        gap: 12px;
    }

    .search-container {
        padding: 20px;
        margin-bottom: 20px;
    }

    #qr-reader {
        width: 100% !important;
        max-width: 350px !important;
        margin: 0 auto;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar {
        width: 220px;
    }

    .content-area {
        margin-left: 220px;
        padding: 18px;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 18px;
    }

    #qr-reader {
        width: 100% !important;
        max-width: 400px !important;
        margin: 0 auto;
    }
}

/* Large devices (desktops, 992px and up) - default styles apply */

.footer {
    margin-top: 50px;
    padding: 8px 0;
    border-top: 1px solid #8b0000;
    text-align: center;
    color: #ffffff;
    background-color: #8b0000;
    position: relative;
    z-index: 500;
    font-size: 0.9rem;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.search-header-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: #1a1a1a;
    padding-top: 20px;
}

.search-results-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

/* Mobile header - visible only when sidebar is hidden */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    width: 100%;
}

.mobile-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.mobile-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Show mobile header when sidebar is hidden */
@media (max-width: 767.98px) {
    .mobile-header {
        display: block;
    }
    
    /* Adjust content padding to account for mobile header */
    .content-area {
        padding-top: 80px;
    }
    
    .content-area main {
        padding-top: 0;
    }
}

/* SelectedItem Page Styles */
.selected-item-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.selected-item-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #444;
}

.selected-item-header .back-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.selected-item-header .back-btn:hover {
    background-color: rgba(255, 107, 107, 0.1);
    transform: translateX(-3px);
}

.selected-item-header h2 {
    margin: 0;
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.selected-item-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
    align-items: start;
}

.product-image-section {
    display: flex;
    justify-content: center;
}

.selected-product-image {
    width: 100%;
    max-width: 300px;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
    background-color: #2d2d2d;
    border: 1px solid #444;
}

.selected-product-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 4rem;
}

.product-details-section {
    padding: 20px 0;
}

.product-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
    line-height: 1.2;
}

.product-brand {
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 30px;
    font-style: italic;
}

.price-section {
    background-color: #2d2d2d;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid #444;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #444;
}

.price-row:last-child {
    border-bottom: none;
}

.price-label {
    font-size: 1.1rem;
    color: #ccc;
    font-weight: 500;
}

.price-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ff6b6b;
}

.scan-another-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.scan-another-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.error-message {
    text-align: center;
    padding: 60px 20px;
    color: #ccc;
}

.error-message i {
    font-size: 4rem;
    color: #ff6b6b;
    margin-bottom: 20px;
}

.error-message h3 {
    color: white;
    margin-bottom: 15px;
}

.error-message .back-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.error-message .back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

/* Mobile responsive styles for SelectedItem */
@media (max-width: 767.98px) {
    .selected-item-container {
        padding: 15px;
        padding-bottom: 100px;
    }

    .selected-item-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .product-title {
        font-size: 1.5rem;
    }

    .selected-product-image {
        max-width: 250px;
        height: 250px;
    }

    .price-section {
        padding: 20px;
    }

    .scan-another-btn {
        max-width: none;
    }
}

#video-container {
    width: 90%;
    max-width: 500px;
    height: 160px; /* fixed height */
    margin: 0 auto;
    overflow: hidden;
    position: relative;
    background: #000;
    border-radius: 10px;
}

#reader {
    width: 100%;
    height: 100%;
    object-fit: cover; /* forces scaling */
}

#scan-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 40px;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 6px;
    pointer-events: none;
}
