/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::-webkit-scrollbar {
    display: none;
}

html {
    scrollbar-width: none;
}

body {
    font-family: 'Lora', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    margin: 0;
    padding: 30px;
    color: #1a2b49;
    max-width: 100vw;
    overflow-x: hidden;
}


.ins {
    color: #ff5722; /* --primary-color */
}

.scipe {
    color: #3f51b5; /* --secondary-color */
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 40px; /* Increased padding for wider appearance */
    background: linear-gradient(90deg, #ffffff, #f8fafc);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 15px rgba(30, 42, 68, 0.08);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-width: 100vw;
    z-index: 900;
    min-height: 80px; /* Taller header for broader look */
    border-radius: 0 0 8px 8px; /* Subtle rounded corners */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.header h1 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 1.2rem;
    white-space: nowrap;
    font-weight: 600;
    color: #1e2a44;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    z-index: 910;
}

.header-right {
    display: flex;
    align-items: center;
}

.sidebar-toggle {
    position: absolute;
    left: 30px; /* Adjusted for wider padding */
    top: 50%;
    transform: translateY(-50%);
    color: #3b82f6;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    z-index: 920;
}

/* Sidebar */
.sidebar-left {
    position: fixed;
    left: 0;
    top: 80px; /* Adjusted for taller header */
    width: 250px;
    height: calc(100vh - 80px);
    background: linear-gradient(180deg, #2c3e50, #1e2a44);
    padding: 20px 0;
    z-index: 800;
    box-shadow: 2px 0 15px rgba(30, 42, 68, 0.1);
    transition: transform 0.3s ease-in-out;
    transform: translateX(-100%);
    max-width: 100vw;
}

.sidebar-left.active {
    transform: translateX(0);
}

.sidebar-left.active ~ main,
.sidebar-left.active ~ #productsList {
    margin-left: 250px;
    margin-top: 80px; /* Adjusted for taller header */
}

.sidebar-item {
    color: #ffffff;
    font-size: 16px;
    padding: 15px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.sidebar-item i {
    margin-right: 15px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #60a5fa;
    padding-left: 30px;
}

.sidebar-item.active {
    background-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-left: 3px solid #60a5fa;
}

/* Account Circle */
.account-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.account-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.account-circle i {
    font-size: 18px;
}

/* Search Container */
.search-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 120px auto 20px; /* Increased top margin for taller header */
    padding: 15px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 90%;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 12px 20px 12px 40px;
    font-size: 16px;
    border: none;
    border-radius: 10px;
    background: #f8fafc;
    color: #1a2b49;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-container input:focus {
    outline: none;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-container input::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.search-container::before {
    content: '\1F50D';
    font-size: 18px;
    color: #6b7280;
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
}

/* Products List */
#productsList {
    transition: margin-left 0.3s ease;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 0 10px;
}

.product-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
    background: #ffffff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #d1e3f6;
    max-width: 100%;
    overflow: hidden;
}

.product-container:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.product-image img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #d1e3f6;
    flex-shrink: 0;
}

.product-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-details div:first-child {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    font-size: 16px;
    color: #1a2b49;
    font-weight: 600;
}

.product-details div:first-child span {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-container button {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 6002;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.product-container button:hover {
    background: linear-gradient(90deg, #2563eb, #3b82f6);
    transform: translateY(-2px);
}

/* Popup and Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 43, 73, 0.7);
    display: none;
    z-index: 999;
}

#editPopup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    width: 90%;
    max-width: 550px;
    max-height: 85vh;
    overflow-y: auto;
    display: none;
    border: 1px solid #d1e3f6;
}

#editPopup h2 {
    font-family: 'Montserrat', sans-serif;
    margin: 0 0 25px;
    font-size: 1.5rem;
    color: #1a2b49;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1e3f6;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #ffffff;
    color: #1a2b49;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    outline: none;
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

.form-group input[readonly] {
    background: #f5f7fa;
    color: #6b7280;
    cursor: not-allowed;
}

.form-group input[type="checkbox"] {
    margin-right: 12px;
    vertical-align: middle;
    accent-color: #3b82f6;
}

#imagePreview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

#imagePreview img {
    max-width: 110px;
    max-height: 110px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #d1e3f6;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

#discountFields {
    margin-left: 25px;
    padding-left: 10px;
    border-left: 2px solid #d1e3f6;
}

#editPopup button {
    padding: 12px 25px;
    margin: 15px 8px 0;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

#editPopup button:first-of-type {
    background: linear-gradient(90deg, #16a34a, #22c55e);
    color: #ffffff;
}

#editPopup button:nth-of-type(2) {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    color: #ffffff;
}

#editPopup button:last-of-type {
    background: linear-gradient(90deg, #dc2626, #ef4444);
    color: #ffffff;
}

#editPopup button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Loader */
#loader {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    background: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.spinner {
    border: 5px solid #d1e3f6;
    border-top: 5px solid #3b82f6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    body {
        padding: 20px 15px;
    }

    .header {
        padding: 15px 30px; /* Slightly reduced for tablet */
        min-height: 70px;
    }

    .header h1 {
        font-size: 1rem;
    }

    .sidebar-toggle {
        left: 20px;
    }

    .sidebar-left {
        width: 200px;
        top: 70px;
        height: calc(100vh - 70px);
    }

    .sidebar-left.active ~ main,
    .sidebar-left.active ~ #productsList {
        margin-left: 200px;
        margin-top: 70px;
    }

    .sidebar-item {
        font-size: 14px;
        padding: 12px 20px;
    }

    .sidebar-item i {
        font-size: 16px;
        width: 20px;
    }

    #productsList {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
        padding: 0 10px;
    }

    .product-container {
        padding: 15px;
        gap: 12px;
    }

    .product-image img {
        width: 80px;
        height: 80px;
    }

    .product-details div:first-child {
        font-size: 14px;
    }

    .search-container {
        margin-top: 100px; /* Adjusted for tablet */
        max-width: 500px;
        width: 90%;
        padding: 12px;
    }

    .search-container input {
        font-size: 14px;
        padding: 10px 15px 10px 35px;
    }

    .search-container::before {
        font-size: 16px;
        left: 20px;
    }

    #editPopup {
        width: 80%;
        max-width: 450px;
        padding: 25px;
    }

    #editPopup h2 {
        font-size: 1.3rem;
    }

    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group textarea {
        font-size: 0.9rem;
        padding: 10px;
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 20px 10px;
    }

    .header {
        padding: 12px 20px;
        min-height: 60px;
    }

    .header h1 {
        font-size: 0.9rem;
        padding: 0 60px; /* Prevent overlap */
    }

    .sidebar-toggle {
        left: 10px;
        font-size: 20px;
        padding: 8px;
    }

    .header-right {
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
    }

    .sidebar-left {
        width: 100%;
        max-width: 250px;
        top: 60px;
        height: calc(100vh - 60px);
        z-index: 950;
        padding: 15px 0;
    }

    .sidebar-left.active {
        transform: translateX(0);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    }

    .sidebar-left.active ~ main,
    .sidebar-left.active ~ #productsList {
        margin-left: 0;
        margin-top: 80px;
    }

    .sidebar-item {
        font-size: 14px;
        padding: 12px 20px;
    }

    #productsList {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 80px;
        padding: 0 5px;
    }

    .product-container {
        padding: 12px;
        gap: 10px;
    }

    .product-image img {
        width: 70px;
        height: 70px;
    }

    .product-details {
        gap: 6px;
    }

    .product-details div:first-child {
        font-size: 13px;
    }

    .product-container button {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    .search-container {
        margin-top: 80px; /* Adjusted for mobile */
        max-width: 400px;
        width: 95%;
        padding: 10px;
    }

    .search-container input {
        font-size: 13px;
        padding: 8px 15px 8px 30px;
    }

    .search-container::before {
        font-size: 14px;
        left: 18px;
    }

    #editPopup {
        width: 90%;
        max-width: 350px;
        padding: 20px;
        max-height: 80vh;
    }

    #editPopup h2 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group textarea {
        font-size: 0.85rem;
        padding: 8px;
    }

    .form-group textarea {
        height: 80px;
    }

    #editPopup button {
        width: 100%;
        margin: 10px 0;
        padding: 10px;
        font-size: 0.9rem;
    }

    #imagePreview img {
        max-width: 80px;
        max-height: 80px;
    }

    #discountFields {
        margin-left: 15px;
        padding-left: 8px;
    }

    .account-circle {
        width: 35px;
        height: 35px;
    }

    .account-circle i {
        font-size: 16px;
    }
}

@media screen and (max-width: 480px) {
    body {
        padding: 15px 5px;
    }

    .header {
        padding: 10px 15px;
        min-height: 50px;
    }

    .header h1 {
        font-size: 0.85rem;
        padding: 0 50px;
    }

    .sidebar-toggle {
        font-size: 18px;
        padding: 5px;
        left: 8px;
    }

    .header-right {
        right: 8px;
    }

    .sidebar-left {
        max-width: 200px;
        top: 50px;
        height: calc(100vh - 50px);
        padding: 10px 0;
    }

    .sidebar-left.active ~ main,
    .sidebar-left.active ~ #productsList {
        margin-top: 70px;
    }

    .sidebar-item {
        font-size: 13px;
        padding: 10px 15px;
    }

    .sidebar-item i {
        font-size: 14px;
        width: 18px;
        margin-right: 10px;
    }

    #productsList {
        margin-top: 70px;
        gap: 12px;
        padding: 0 5px;
    }

    .product-container {
        padding: 10px;
        gap: 8px;
    }

    .product-image img {
        width: 60px;
        height: 60px;
    }

    .product-details {
        gap: 5px;
    }

    .product-details div:first-child {
        font-size: 12px;
    }

    .product-container button {
        padding: 7px 12px;
        font-size: 0.8rem;
    }

    .search-container {
        margin-top: 60px; /* Adjusted for small mobile */
        max-width: 300px;
        width: 95%;
        padding: 8px;
    }

    .search-container input {
        font-size: 12px;
        padding: 7px 15px 7px 28px;
    }

    .search-container::before {
        font-size: 13px;
        left: 16px;
    }

    #editPopup {
        width: 95%;
        padding: 15px;
    }

    #editPopup h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 0.8rem;
    }

    .form-group input[type="text"],
    .form-group input[type="number"],
    .form-group textarea {
        font-size: 0.8rem;
        padding: 7px;
    }

    .form-group textarea {
        height: 70px;
    }

    #editPopup button {
        padding: 8px;
        font-size: 0.85rem;
    }

    #imagePreview img {
        max-width: 70px;
        max-height: 70px;
    }

    .account-circle {
        width: 30px;
        height: 30px;
    }

    .account-circle i {
        font-size: 14px;
    }

    #loader .spinner {
        width: 40px;
        height: 40px;
        border-width: 4px;
    }
}

@media screen and (max-width: 768px) {
    #overlay {
        background: rgba(0, 0, 0, 0.6);
    }

    #loader {
        padding: 15px;
    }

    #loader .spinner {
        width: 45px;
        height: 45px;
    }
}