/* Google Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&display=swap');

:root {
    --color-primary: #1e88e5;
    --color-secondary: #ff7043;
    
    --color-text-light: #2c3e50;
    --color-background-light: #f4f6f8;
    --color-card-light: #ffffff;
    --color-border-light: #ecf0f1;
    --color-shadow-light: rgba(0, 0, 0, 0.1);

    --color-text-dark: #ecf0f1;
    --color-background-dark: #2c3e50;
    --color-card-dark: #34495e;
    --color-border-dark: #4a637c;
    --color-shadow-dark: rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode {
    background-color: var(--color-background-light);
    color: var(--color-text-light);
}

body.dark-mode {
    background-color: var(--color-background-dark);
    color: var(--color-text-dark);
}

.logo {
    height: auto;
    width: 200px;
    cursor: pointer;
}

.logo-light,
.logo-dark {
    display: none;
}

body.light-mode .logo-light { 
    display: block !important; 
}

body.dark-mode .logo-dark { 
    display: block !important; 
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 2px solid var(--color-border-light);
    margin-bottom: 20px;
}

body.dark-mode header {
    border-bottom-color: var(--color-border-dark);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
}

.logout-btn {
    text-decoration: none;
    background-color: var(--color-secondary);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #ff5722;
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.mode-label {
    margin-left: 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

.theme-switch {
    display: inline-block;
    height: 24px;
    position: relative;
    width: 45px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: #ccc;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: 0.4s;
}

.slider:before {
    background-color: #fff;
    bottom: 4px;
    content: "";
    height: 16px;
    left: 4px;
    position: absolute;
    transition: 0.4s;
    width: 16px;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(21px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.search-bar {
    display: flex;
    margin-bottom: 25px;
    gap: 10px;
}

.search-bar input[type="text"] {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background-color: var(--color-card-light);
    color: var(--color-text-light);
}

body.dark-mode .search-bar input[type="text"] {
    border-color: var(--color-border-dark);
    background-color: var(--color-card-dark);
    color: var(--color-text-dark);
}

.search-bar button {
    padding: 12px 20px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
}

.search-bar button:hover {
    background-color: #1a76c3;
}

/* --- CATEGORY NAV STYLES (UPDATED) --- */
.category-nav {
    display: flex;
    flex-wrap: nowrap; /* Prevent wrapping for a clean horizontal bar */
    overflow-x: auto; /* Enable horizontal scrolling if needed */
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px 0; /* Add vertical padding for separation */
    border-bottom: 1px solid var(--color-border-light);
    /* Hide scrollbar */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.category-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

body.dark-mode .category-nav {
    border-bottom-color: var(--color-border-dark);
}

.category-link {
    display: block;
    padding: 8px 15px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap; /* Keep categories on one line */
    flex-shrink: 0; /* Prevent links from shrinking */
    
    color: var(--color-text-light);
    background-color: #e0e0e0; /* Light background for unselected */
    border: none; /* Use solid background instead of border */
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

body.dark-mode .category-link {
    color: var(--color-text-dark);
    background-color: #4a637c; /* Dark background for unselected */
}

.category-link:hover {
    background-color: #c0c0c0;
    transform: translateY(-1px);
}

body.dark-mode .category-link:hover {
    background-color: #5d7591;
}

/* Active state for category link */
.category-link.active {
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
    transform: none; /* Override hover transform if active */
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.product-card {
    background-color: var(--color-card-light);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--color-shadow-light);
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
}

body.dark-mode .product-card {
    background-color: var(--color-card-dark);
    box-shadow: 0 4px 15px var(--color-shadow-dark);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(30, 136, 229, 0.2), 0 0 0 2px var(--color-primary);
}

.product-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 15px;
}

.product-card h3 {
    font-size: 1.15rem;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text-light);
}

body.dark-mode .product-card h3 {
    color: var(--color-text-dark);
}

.product-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-secondary);
    margin-bottom: 5px;
}

.product-category {
    font-size: 0.85rem;
    color: #95a5a6;
    margin-bottom: 15px;
}

.view-deal-btn {
    display: inline-block;
    width: 100%;
    text-align: center;
    padding: 15px;
    background: linear-gradient(145deg, var(--color-secondary), #ff5722);
    color: white;
    border-radius: 10px;
    font-weight: 800;
    margin-top: 20px; 
    font-size: 1.2rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 6px 15px rgba(255, 112, 67, 0.7);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: scale(1);
    border: none;
    cursor: pointer;
}

.view-deal-btn:hover {
    background: linear-gradient(145deg, #ff5722, #e04e17);
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(255, 112, 67, 0.9);
}

.coupon-tag {
    background-color: #f39c12;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: 700;
    margin-bottom: 10px;
    border: 2px dashed #ffe0b2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.coupon-tag:hover {
    background-color: #e67e22;
}

.coupon-label {
    margin-right: 5px;
    font-weight: 400;
    opacity: 0.8;
}

.coupon-code-value {
    font-size: 1.1rem;
    letter-spacing: 1px;
    text-align: center;
}

.copy-icon-wrapper {
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 3px;
    background-color: rgba(255, 255, 255, 0.2);
    margin-left: 10px;
    transition: background-color 0.2s;
}

.copy-icon-wrapper:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.copy-icon-wrapper .fa-copy {
    font-size: 1.1rem;
    color: white;
}

.coupon-tag.copied {
    background-color: #2ecc71;
    border-color: #27ae60;
    justify-content: center;
}

.coupon-tag.copied .coupon-info,
.coupon-tag.copied .copy-icon-wrapper {
    display: none;
}

.copy-feedback {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
}

.toast {
    background-color: #2ecc71;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
    transform: translateY(20px);
    font-size: 1rem;
    font-weight: 600;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- LOGIN PAGE STYLES (UPDATED) --- */
body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    max-width: 450px;
    width: 100%;
    padding: 50px 40px;
    background-color: var(--color-card-light);
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--color-shadow-light);
    text-align: center;
    position: relative;
    overflow: hidden;
}

body.dark-mode .login-container {
    background-color: var(--color-card-dark);
    box-shadow: 0 10px 40px var(--color-shadow-dark);
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, var(--color-primary), var(--color-secondary));
    opacity: 0.05;
    z-index: 0;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.login-container > * {
    position: relative;
    z-index: 1;
}

.login-container .logo {
    width: 180px;
    margin-bottom: 30px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.login-container h2 {
    color: var(--color-primary);
    margin-bottom: 10px;
    font-size: 2rem;
    font-weight: 700;
}

.login-container p.subtitle {
    color: #95a5a6;
    margin-bottom: 35px;
    font-size: 0.95rem;
}

.login-container .error-message {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    margin-bottom: 25px;
    font-size: 0.9rem;
    text-align: left;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

body.dark-mode .login-container .error-message {
    background-color: rgba(231, 76, 60, 0.15);
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-container input {
    padding: 15px 18px;
    border: 2px solid var(--color-border-light);
    border-radius: 10px;
    font-size: 1rem;
    background-color: var(--color-card-light);
    color: var(--color-text-light);
    transition: all 0.3s ease;
}

body.dark-mode .login-container input {
    border-color: var(--color-border-dark);
    background-color: var(--color-card-dark);
    color: var(--color-text-dark);
}

.login-container input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(30, 136, 229, 0.1);
    transform: translateY(-2px);
}

.login-container button {
    padding: 15px;
    background: linear-gradient(135deg, var(--color-primary), #1565c0);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(30, 136, 229, 0.3);
    margin-top: 10px;
}

.login-container button:hover {
    background: linear-gradient(135deg, #1565c0, var(--color-primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 136, 229, 0.4);
}

.login-container button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(30, 136, 229, 0.3);
}

/* --- ADMIN PANEL --- */
.admin-section {
    padding: 20px;
    background-color: var(--color-card-light);
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--color-shadow-light);
    margin-bottom: 25px;
    transition: background-color 0.3s;
}

body.dark-mode .admin-section {
    background-color: var(--color-card-dark);
    box-shadow: 0 2px 10px var(--color-shadow-dark);
}

.admin-section h2 {
    color: var(--color-primary);
    margin-bottom: 20px;
    text-align: center;
}

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

.add-product form input,
.add-product form textarea {
    padding: 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    background-color: inherit;
    color: inherit;
    transition: border-color 0.3s;
}

.add-product form input:focus,
.add-product form textarea:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 5px rgba(30, 136, 229, 0.3);
}

.add-product form textarea {
    grid-column: 1 / -1;
    resize: vertical;
}

.add-product form .checkbox-container {
    grid-column: 1 / 2;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--color-text-light);
}

body.dark-mode .add-product form .checkbox-container {
    color: var(--color-text-dark);
}

.add-product form button {
    grid-column: 2 / -1;
    padding: 12px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

.add-product form button:hover {
    background-color: #1a76c3;
}

.product-actions button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    margin-right: 5px;
}

.product-actions button:first-child {
    background-color: var(--color-primary);
    color: white;
}

.product-actions .delete-btn {
    background-color: var(--color-secondary);
    color: white;
}

.product-actions .delete-btn:hover {
    background-color: #ff5722;
}

.product-card .product-notes {
    font-size: 0.9rem;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--color-border-light);
    white-space: pre-wrap;
    word-wrap: break-word;
}

body.dark-mode .product-card .product-notes {
    border-top-color: var(--color-border-dark);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: var(--color-card-light);
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px var(--color-shadow-light);
    position: relative;
	
}

body.dark-mode .modal-content {
    background-color: var(--color-card-dark);
    box-shadow: 0 5px 15px var(--color-shadow-dark);
}

.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 25px;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--color-primary);
    text-decoration: none;
    cursor: pointer;
}

.input-group {
    position: relative;
    margin-bottom: 25px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    background-color: var(--color-card-light);
    color: var(--color-text-light);
    transition: border-color 0.3s;
}

body.dark-mode .input-group input,
body.dark-mode .input-group textarea {
    background-color: var(--color-card-dark);
    border-color: var(--color-border-dark);
    color: var(--color-text-dark);
}

.input-group label {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #95a5a6;
    pointer-events: none;
    transition: all 0.2s ease;
    background-color: transparent;
    padding: 0 4px;
    font-size: 1rem;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label {
    top: -12px;
    left: 8px;
    font-size: 0.75rem;
    color: var(--color-primary);
    background-color: var(--color-card-light);
}

body.dark-mode .input-group input:focus + label,
body.dark-mode .input-group input:not(:placeholder-shown) + label,
body.dark-mode .input-group textarea:focus + label,
body.dark-mode .input-group textarea:not(:placeholder-shown) + label {
    background-color: var(--color-card-dark);
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 5px rgba(30, 136, 229, 0.5);
}

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

#edit-form button[type="submit"] {
    padding: 12px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    transition: background-color 0.3s;
}

#edit-form button[type="submit"]:hover {
    background-color: #1a76c3;
}

.image-preview-container {
    text-align: center;
    margin-bottom: 25px;
}

#image-preview {
    max-width: 100%;
    height: auto;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid var(--color-border-light);
    display: none;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.1rem;
    padding: 40px;
    color: #7f8c8d;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .logo {
        width: 150px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }

    .theme-switch-wrapper {
        margin: 0;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar button {
        width: 100%;
    }

    .category-nav {
        justify-content: center;
    }

    .admin-section h2 {
        text-align: center;
    }

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

    .input-grid {
        grid-template-columns: 1fr;
    }

    .add-product form .checkbox-container {
        grid-column: 1 / -1;
        justify-content: center;
    }
    
    .add-product form button {
        grid-column: 1 / -1;
    }
    
    .login-container {
        padding: 40px 30px;
    }
	
	.coupon-tag {
        font-size: 0.85rem;
        padding: 8px 10px;
    }
    
    .coupon-code-value {
        font-size: 1rem;
    }
    
    .copy-icon-wrapper {
        padding: 4px;
        margin-left: 8px;
    }
    
    .copy-icon-wrapper .fa-copy {
        font-size: 1rem;
    }
	
	.product-card {
        padding: 15px;
    }
	
	
}