/* Reset styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Prompt', Tahoma, Arial, sans-serif;
}

/* Body styling */
body {
    background: linear-gradient(135deg, #e0e7ff, #f0f2f5);
    color: #1a202c;
    min-height: 100vh;
    padding: 20px;
}

/* Container styling */
.container {
    max-width: 1200px;
    background: #ffffff;
    margin: 20px auto;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
}

/* Login card styling */
.login-card {
    max-width: 400px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.login-card h2 {
    margin-bottom: 20px;
    color: #2d3748;
}

.register-link {
    margin-top: 20px;
    font-size: 0.9rem;
}

/* Header styling */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e8f0;
}

.user-info h2 {
    font-size: 1.8rem;
    color: #2d3748;
    margin-bottom: 5px;
}

.user-info p {
    font-size: 1rem;
    color: #4a5568;
}

/* Logout link */
.logout {
    display: inline-block;
    padding: 10px 15px;
    background: #ef4444;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s;
}

.logout:hover {
    background: #dc2626;
    text-decoration: none;
}

/* Input and select styling */
input, select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Button styling */
button {
    width: 100%;
    padding: 12px;
    background: #3b82f6;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

button:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* Link styling */
a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    text-decoration: underline;
    color: #2563eb;
}

/* Cart container */
.cart-container {
    margin-top: 20px;
}

.cart-container h3 {
    font-size: 1.5rem;
    color: #2d3748;
    margin-bottom: 25px;
    text-align: center;
}

/* Cart grid - แสดงสินค้า 3 คอลัมน์ */
.cart-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    padding: 10px;
}

/* Cart item */
.cart-item {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.cart-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.cart-item-image {
    text-align: center;
    margin-bottom: 15px;
}

.cart-item-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.cart-item h4 {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 10px;
    font-weight: 600;
}

.cart-item .price {
    font-size: 1.1rem;
    color: #3b82f6;
    font-weight: 600;
    margin-bottom: 8px;
}

.cart-item .stock {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 15px;
}

.quantity-control {
    margin: 15px 0;
}

.quantity-control input {
    width: 80px;
    margin: 0 auto;
    text-align: center;
}

.add-to-cart-btn {
    background: #10b981;
    margin-top: 10px;
}

.add-to-cart-btn:hover {
    background: #059669;
}

/* Action links */
.action-links {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.report-link {
    display: inline-block;
    padding: 12px 20px;
    background: #8b5cf6;
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.3s;
}

.report-link:hover {
    background: #7c3aed;
    text-decoration: none;
}

/* Notifications */
.success {
    color: #10b981;
    background: #ecfdf5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #10b981;
}

.error {
    color: #ef4444;
    background: #fef2f2;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #ef4444;
}

/* Layout for main content */
.main-content {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    margin-right: 300px; /* Space for fixed sidebar */
}

.products-section {
    flex: 1;
}

.cart-sidebar {
    position: fixed;
    right: 20px;
    top: 20px;
    width: 280px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.cart-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.cart-count {
    background: #3b82f6;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
}

.empty-cart {
    text-align: center;
    color: #64748b;
    padding: 20px 0;
}

.cart-item-row {
    display: flex;
    flex-direction: column;
    padding: 10px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.item-info h4 {
    margin: 0 0 5px 0;
    font-size: 1rem;
}

.item-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
}

.item-quantity, .item-total {
    margin: 5px 0;
    font-size: 0.9rem;
}

.item-actions {
    margin-top: 5px;
}

.remove-btn {
    color: #ef4444;
    font-size: 0.8rem;
    text-decoration: none;
}

.remove-btn:hover {
    text-decoration: underline;
}

.cart-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
}

.cart-total {
    margin-bottom: 15px;
}

.cart-total h4 {
    margin: 0;
    color: #3b82f6;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clear-cart-btn, .checkout-btn, .save-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

.clear-cart-btn {
    background: #f1f5f9;
    color: #64748b;
}

.clear-cart-btn:hover {
    background: #e2e8f0;
}

.checkout-btn {
    background: #10b981;
    color: white;
}

.checkout-btn:hover {
    background: #059669;
    text-decoration: none;
}

.save-btn {
    background: #3b82f6;
    color: white;
    border: none;
}

.save-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* Responsive design */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        margin-right: 0;
    }
    
    .cart-sidebar {
        position: static;
        width: 100%;
        max-height: none;
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 100%;
        margin: 10px;
        padding: 20px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .user-info {
        margin-bottom: 15px;
    }
    
    .cart-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cart-item {
        max-width: 350px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .cart-grid {
        grid-template-columns: 1fr;
    }
    
    .cart-item {
        max-width: none;
    }
}

/* Checkout page styles */
.back-btn {
    display: inline-block;
    padding: 10px 15px;
    background: #6b7280;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

.back-btn:hover {
    background: #4b5563;
    text-decoration: none;
}

.checkout-summary {
    margin-top: 20px;
}

.order-items {
    margin-bottom: 30px;
}

.order-items table {
    width: 100%;
    border-collapse: collapse;
}

.order-items th, .order-items td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.order-items th {
    background: #f1f5f9;
    font-weight: 600;
}

.total-row {
    font-weight: 600;
    background: #f8fafc;
}

.total-row td {
    border-top: 2px solid #e2e8f0;
}

.payment-form {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
}

.payment-methods {
    margin-bottom: 20px;
}

.payment-methods h3 {
    margin-bottom: 15px;
}

.method-options {
    display: flex;
    gap: 20px;
}

.method-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.cancel-btn, .confirm-btn {
    padding: 12px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.cancel-btn {
    background: #f1f5f9;
    color: #64748b;
}

.cancel-btn:hover {
    background: #e2e8f0;
    text-decoration: none;
}

.confirm-btn {
    background: #10b981;
    color: white;
}

.confirm-btn:hover {
    background: #059669;
}

.checkout-success {
    text-align: center;
    padding: 40px 0;
}

.checkout-success p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #10b981;
}

.continue-btn {
    display: inline-block;
    padding: 12px 25px;
    background: #3b82f6;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
}

.continue-btn:hover {
    background: #2563eb;
    text-decoration: none;
}
/* Admin actions */
.admin-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
}

.admin-actions button, .admin-actions a {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.admin-actions a {
    color: #ef4444;
}

/* Add product form */
.add-product-form {
    margin-top: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.add-product-form input {
    margin-bottom: 10px;
}

.add-product-form button {
    width: auto;
    padding: 10px 20px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 12px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Filter form */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
}

.filter-form button {
    width: auto;
    padding: 10px 20px;
    align-self: flex-end;
}

/* Table enhancements */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: #f1f5f9;
    font-weight: 600;
}
.add-product-form button {
    width: auto;
    padding: 10px 15px;
    background: #10b981;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.add-product-form button:hover {
    background: #059669;
    transform: translateY(-2px);
}

/* Modal for Add Product */
#addModal .modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 400px;
    border-radius: 12px;
}

#addModal .modal-content h3 {
    margin-bottom: 15px;
    color: #2d3748;
}

#addModal .modal-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

#addModal .modal-content button {
    width: 100%;
    padding: 10px;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

#addModal .modal-content button:hover {
    background: #2563eb;
}

/* Category links */
.category-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.category-btn {
    padding: 8px 15px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
}

.category-btn:hover, .category-btn.active {
    background: #3b82f6;
    color: white;
}
/* Category bar menu */
.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    background: #f8fafc;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.category-bar-item {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s;
    position: relative;
}

.category-bar-item:hover, .category-bar-item.active {
    background: #3b82f6;
    color: white;
}

.category-bar-item .category-action {
    margin-left: 10px;
    font-size: 1rem;
    cursor: pointer;
    color: #64748b;
    transition: color 0.3s;
}

.category-bar-item:hover .category-action,
.category-bar-item.active .category-action {
    color: white;
}

.category-bar-item .category-action.add {
    margin-left: auto;
}

.category-bar-item .category-action:hover {
    color: #10b981;
}

.category-bar-item .category-action.remove:hover {
    color: #ef4444;
}
