/*
   =========================================
   1. VARIABLES & RESET
   =========================================
*/
:root {
    /* --- NEW COLOR PALETTE --- */
    --primary: #080708;
    /* Vampire Black */
    --accent: #3772ff;
    /* Blue Crayola */
    --danger: #df2935;
    /* Amaranth Red */
    --highlight: #fdca40;
    /* Sunglow Yellow */
    --bg-color: #e6e8e6;
    /* Platinum */

    /* Neutral / Functional Colors */
    --card-bg: #ffffff;
    --text-color: #080708;
    /* Using Primary for main text */
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius: 12px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding-bottom: 60px;
    line-height: 1.6;
}

/*
   =========================================
   2. NAVIGATION
   =========================================
*/
nav {
    background-color: var(--primary);
    padding: 0 20px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

nav a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    padding: 5px 0;
}

nav a:hover {
    color: var(--highlight);
}

/*
   =========================================
   3. FORMS, INPUTS & BUTTONS
   =========================================
*/
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9em;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    margin: 0;
    border: 2px solid #e9ecef;
    background-color: #ffffff;
    /* Updated to white for better contrast against new grey bg */
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23080708' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

input:focus,
select:focus,
textarea:focus {
    background-color: #fff;
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 4px rgba(55, 114, 255, 0.15);
    /* Updated to match new accent */
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 5px;
    display: block;
    min-height: 20px;
}

.input-error {
    border-color: var(--danger) !important;
    background-color: rgba(223, 41, 53, 0.05) !important;
    /* Updated fade */
}

.main-error {
    color: var(--danger);
    text-align: center;
    font-weight: bold;
    margin: 10px 0;
}

/* Buttons */
button {
    cursor: pointer;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    background-color: var(--primary);
    color: white;
    transition: transform 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    opacity: 0.95;
}

/* Extra Button Classes */
.btn-small {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.confirm-btn {
    background-color: #2b9348;
    padding: 6px 12px;
    font-size: 0.85rem;
}

.confirm-btn:hover {
    background-color: #1e6b34;
}

.btn-rate {
    padding: 4px 8px;
    font-size: 0.75rem;
    margin-left: 8px;
    background-color: #8d99ae;
    border-radius: 4px;
}

.btn-return {
    background-color: var(--highlight);
    color: var(--primary);
    font-size: 0.85rem;
    margin-left: 10px;
    padding: 6px 12px;
}

.link-btn {
    background: none;
    color: var(--accent);
    padding: 0;
    box-shadow: none;
    transform: none;
    text-decoration: underline;
    display: inline;
}

.link-btn:hover {
    color: var(--primary);
    transform: none;
    background: none;
}

/*
   =========================================
   4. LAYOUT CONTAINERS
   =========================================
*/
.hidden {
    display: none !important;
}

#loginSection,
#registerSection {
    max-width: 400px;
    width: 90%;
    margin: 8vh auto;
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

#loginSection h2,
#registerSection h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: var(--primary);
}

#loginSection button[type="submit"],
#registerSection button[type="submit"] {
    width: 100%;
    background-color: var(--accent);
    margin-top: 10px;
    margin-bottom: 15px;
}

.cart-container,
.orders-container,
.admin-section {
    max-width: 1000px;
    width: 90%;
    margin: 40px auto;
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

h2,
h3 {
    color: var(--primary);
    border-bottom: 2px solid var(--accent);
    padding-bottom: 15px;
    margin-top: 0;
}

/*
   =========================================
   5. TABLES
   =========================================
*/
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
}

th {
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    padding: 15px;
    text-align: left;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
}

tr:nth-child(even) td {
    background-color: #fafafa;
}

tr:hover td {
    background-color: #f8f9fa;
}

td img {
    border-radius: 4px;
}

/* Status Colors */
.status-pending {
    color: var(--highlight);
    /* Now Yellow/Gold */
    font-weight: bold;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.1);
    /* Added slightly for readability on white */
}

.status-confirmed {
    color: var(--accent);
    font-weight: bold;
}

.status-rejected {
    color: var(--danger);
    font-weight: bold;
}

/*
   =========================================
   6. PRODUCTS GRID
   =========================================
*/
.filter-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
}

.filter-bar label {
    font-weight: 600;
    margin: 0;
}

.filter-bar select {
    width: 250px;
    border: 2px solid #e9ecef;
    cursor: pointer;
}

#productsContainer {
    max-width: 1250px;
    width: 90%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

#wishlistContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    border: 1px solid #f1f3f5;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.product-card img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.product-card h3 {
    font-size: 1.2rem;
    margin: 10px 0;
    color: var(--primary);
}

.product-card .price {
    font-size: 1.4rem;
    color: var(--accent);
    font-weight: 800;
}

.product-card button {
    width: 100%;
    margin-top: 10px;
}

.wishlist-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #ccc;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    width: 40px !important;
}

.wishlist-active {
    color: #ff4d6d !important;
}

/*
   =========================================
   7. ADMIN & CART EXTRAS
   =========================================
*/
.admin-section .form-container {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
}

.edit-btn {
    background-color: var(--accent);
    padding: 6px 12px;
    font-size: 0.85rem;
}

.delete-btn {
    background-color: var(--danger);
    padding: 6px 12px;
    font-size: 0.85rem;
}

.total-section {
    text-align: right;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f1f3f5;
}

.total-section p {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.checkout-btn {
    background-color: var(--accent);
    padding: 15px 40px;
    border-radius: 50px;
}

/* =========================================
   CATEGORY TAGS
   =========================================
*/
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.category-tag {
    background-color: #e9ecef;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.category-tag:hover {
    background-color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.delete-cat-btn {
    text-decoration: none;
    color: #999;
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: all 0.2s;
}

.delete-cat-btn:hover {
    background-color: var(--danger);
    color: white;
}