@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Open Sans', sans-serif;
    padding: 20px;
    margin: 0;
}

.page-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

#category-sidebar {
    width: 250px;
    background-color: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    height: calc(100vh - 140px);
    max-height: calc(100vh - 140px);
    position: sticky;
    top: 80px;
    overflow-y: auto;
    box-sizing: border-box;
}


@media (max-width: 768px) {
    #category-sidebar {
        height: auto;
        max-height: 200px;
        position: relative;
        top: 0;
        margin-bottom: 20px;
    }
}

#category-sidebar h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.categories-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.categories-list li {
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: color 0.2s;
}

.categories-list li:last-child {
    border-bottom: none;
}

.categories-list li:hover {
    color: #4f46e5;
}

.categories-list li.active {
    color: #4f46e5;
    font-weight: bold;
}

main {
    flex: 1;
    padding: 0 10px;
    overflow-x: hidden;
}

#product-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px;
    padding: 10px;
    margin: 0;
    overflow-x: hidden;
}


@media (max-width: 575px) {
    #product-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}


@media (min-width: 576px) and (max-width: 767px) {
    #product-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}


@media (min-width: 768px) and (max-width: 991px) {
    #product-container {
        grid-template-columns: repeat(3, 1fr);
    }
}


@media (min-width: 992px) and (max-width: 1199px) {
    #product-container {
        grid-template-columns: repeat(5, 1fr);
    }
}


@media (min-width: 1200px) {
    #product-container {
        grid-template-columns: repeat(5, 1fr);
    }
}

.card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 280px;
    max-width: 100%;
}

.card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
    display: block;
    flex-shrink: 0;
}


@media (max-width: 767px) {
    .card {
        min-height: 250px;
        padding: 10px;
    }

    .card img {
        height: 100px;
    }
}

.card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: flex-end;
    overflow: hidden;
}

.card h3 {
    margin: 5px 0;
    flex-grow: 0;
}

.card p {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 5px 0;
}

.card button {
    margin-top: 10px;
    flex-shrink: 0;
}

.card.out-of-stock {
    opacity: 0.6;
    filter: grayscale(100%);
    background-color: #f3f4f6;
}

.card.out-of-stock img {
    opacity: 0.6;
}

.card.out-of-stock h3,
.card.out-of-stock p {
    color: #6b7280;
}

.out-of-stock-label {
    color: #ef4444 !important;
    font-weight: bold;
    text-align: center;
    margin: 10px 0 !important;
}

.product-link {
    text-decoration: none;
    color: inherit;
}

.product-link:hover {
    color: #4f46e5;
}

button, .btn {
    background-color: #4f46e5;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

button:hover, .btn:hover {
    background-color: #4338ca;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 1000;
}

#nav-left {
    display: flex;
    align-items: center;
}

#nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

#auth-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

#auth-nav .btn {
    background-color: #8b5cf6;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    margin-left: 5px;
}

#auth-nav .btn:hover {
    background-color: #7c3aed;
}

.cart-count-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ef4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.cart-count-badge.zero {
    background-color: #9ca3af;
}


.cart-modal-content {
    width: 80%;
    max-width: 700px;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e5e7eb;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px;
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.cart-item-price {
    color: #4f46e5;
    font-weight: bold;
    margin-bottom: 5px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-item-quantity button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
}

.cart-item-quantity button:hover {
    background-color: #e5e7eb;
}

.cart-item-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.remove-item-btn {
    background-color: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.remove-item-btn:hover {
    background-color: #dc2626;
}

.cart-total-section {
    padding: 15px 0;
    border-top: 1px solid #e5e7eb;
    margin-top: 15px;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
}

.checkout-btn {
    background-color: #10b981;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-top: 15px;
}

.checkout-btn:hover {
    background-color: #059669;
}


.checkout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.checkout-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.checkout-form {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.checkout-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #374151;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.user-info-review {
    background-color: #f9fafb;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.user-info-review p {
    margin: 5px 0;
}

.order-summary {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    height: fit-content;
    align-self: start;
}

.order-summary h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.order-item:last-child {
    border-bottom: none;
}

.order-item-name {
    flex: 2;
}

.order-item-quantity {
    flex: 1;
    text-align: center;
}

.order-item-price {
    flex: 1;
    text-align: right;
    font-weight: 500;
}

.order-total {
    margin-top: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.total-row.total-final {
    font-weight: bold;
    font-size: 1.1em;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}

.total-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 10px 0;
}

.btn-primary {
    background-color: #10b981;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    margin-bottom: 10px;
}

.btn-primary:hover {
    background-color: #059669;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.btn-secondary:hover {
    background-color: #4b5563;
}


@media (max-width: 768px) {
    .page-container {
        flex-direction: column;
    }

    #category-sidebar {
        width: 100%;
        margin-bottom: 20px;
        height: auto;
        max-height: 200px;
        position: relative;
        top: 0;
    }

    .card {
        width: 100%;
        height: auto;
    }

    .card img {
        height: 120px;
    }

    .card-content {
        flex-direction: column;
        justify-content: flex-start;
    }

    nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 10px;
    }

    #nav-left {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    #nav-right {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }

    #admin-panel-btn {
        margin-right: 10px;
    }

    .categories-list {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }

    .categories-list li {
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    .product-detail-card {
        flex-direction: column;
    }

    .product-image-section, .product-info-section {
        min-width: 100%;
    }

    .checkout-content {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-options {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .form-group-half, .form-group-third {
        flex: 1 1 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .card h3 {
        font-size: 1.1rem;
    }

    .card p {
        font-size: 0.9rem;
    }

    .card button {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    h1, h2 {
        font-size: 1.5rem;
    }

    .modal-content {
        width: 95%;
        margin: 20px auto;
    }

    .admin-modal-content {
        width: 95%;
        margin: 20px auto;
    }

    .cart-modal-content {
        width: 95%;
        margin: 20px auto;
    }
}

.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.profile-info, .order-history {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.profile-info h3, .order-history h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.user-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.user-info-item {
    display: flex;
    flex-direction: column;
}

.user-info-label {
    font-weight: bold;
    color: #6b7280;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.user-info-value {
    font-size: 1.1rem;
    color: #1f2937;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
}

.orders-table th,
.orders-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.orders-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #1f2937;
}

.orders-table tr:hover {
    background-color: #f9fafb;
}

.order-status {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-pending {
    background-color: #fef3c7;
    color: #d97706;
}

.status-completed {
    background-color: #d1fae5;
    color: #059669;
}

.status-cancelled {
    background-color: #fee2e2;
    color: #dc2626;
}

.no-orders {
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-style: italic;
}


.admin-modal-content {
    width: 80%;
    max-width: 800px;
}

.admin-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.admin-option {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-option:hover {
    background: #f3f4f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.admin-option h3 {
    margin: 0 0 10px 0;
    color: #4f46e5;
}

.admin-option p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.admin-form {
    display: none;
    width: 100%;
}

.admin-form.active {
    display: block;
}

.admin-form h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group-full {
    flex: 1 1 100%;
}

.form-group-half {
    flex: 1 1 48%;
}

.form-group-third {
    flex: 1 1 30%;
}

.admin-form .form-group {
    margin-bottom: 15px;
}

.admin-form .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #374151;
}

.admin-form .form-group input,
.admin-form .form-group select,
.admin-form .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.admin-form .form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.admin-form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}


.product-detail-card {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.product-image-section {
    flex: 1;
    min-width: 300px;
}

.product-image-section img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-info-section {
    flex: 1;
    min-width: 300px;
}

.product-info-section h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #1f2937;
}

.product-price {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4f46e5;
    margin-bottom: 15px;
}

.product-stock {
    font-size: 1.2rem;
    color: #10b981;
    margin-bottom: 20px;
}

.product-description h3 {
    margin-bottom: 10px;
    color: #374151;
}

.product-description p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 30px;
}

.quantity-selector {
    margin-bottom: 30px;
}

.quantity-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #374151;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-controls input {
    width: 80px;
    padding: 10px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 1rem;
}

.quantity-controls button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    color: #374151;
}

.quantity-controls button:hover {
    background-color: #e5e7eb;
}

.warning-message {
    color: #ef4444;
    font-weight: bold;
    margin-top: 10px;
}

.action-buttons {
    display: flex;
    gap: 15px;
}

@media (max-width: 768px) {
    .product-detail-card {
        flex-direction: column;
    }

    .product-image-section,
    .product-info-section {
        min-width: 100%;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        max-width: 100%;
    }
}


.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.close-button {
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}

.close-button:hover {
    color: #374151;
}

.modal-body {
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

.modal-image-section {
    width: 100%;
    text-align: center;
}

.modal-image-section img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
}

.modal-info-section {
    width: 100%;
}

.modal-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4f46e5;
    margin-bottom: 10px;
}

.modal-stock {
    font-size: 1rem;
    color: #10b981;
    margin-bottom: 15px;
}

.modal-description h3 {
    margin-bottom: 5px;
    color: #374151;
}

.modal-description p {
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 20px;
}

.quantity-selector {
    margin-bottom: 20px;
}

.quantity-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #374151;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.quantity-controls input {
    width: 70px;
    padding: 8px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 1rem;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    color: #374151;
}

.quantity-btn:hover {
    background-color: #e5e7eb;
}

.modal-action-buttons {
    display: flex;
    gap: 12px;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-body {
        padding: 15px;
    }

    .modal-action-buttons {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}