/* ---------- Global ---------- */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #111827;
    color: white;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

a {
    color: inherit;
}

/* ---------- Header ---------- */

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 60px;
    background: #000;
    position: sticky;
    top: 0;
    z-index: 999;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    color: #0d6efd;
}

.brand-link {
    text-decoration: none;
    color: #0d6efd;
}

nav a {
    color: white;
    margin-left: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: .3s;
}

nav a:hover {
    color: #0d6efd;
}

/* ---------- Hero ---------- */

.hero {
    text-align: center;
    padding: 90px;
    background: linear-gradient(135deg, #0d6efd, #14213d);
}

.hero h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

.hero p {
    font-size: 20px;
    margin-bottom: 30px;
}

/* ---------- Buttons ---------- */

button {
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 28px;
    cursor: pointer;
    transition: .3s;
    font-size: 16px;
}

button:hover {
    background: #0056d2;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #374151;
}

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

/* ---------- Products ---------- */

.products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    padding: 50px;
}

.card {
    background: #1f2937;
    border-radius: 15px;
    text-align: center;
    padding: 25px;
    transition: .3s;
    box-shadow: 0 10px 20px rgba(0, 0, 0, .25);
}

.card:hover {
    transform: translateY(-8px);
}

.product-image {
    width: 220px;
    height: 220px;
    object-fit: contain;
    margin-bottom: 20px;
}

.price {
    color: #0d6efd;
    font-size: 24px;
    margin: 15px 0;
    font-weight: bold;
}

.out-of-stock {
    color: #f87171;
    font-weight: bold;
    margin: 10px 0;
}

.empty-state {
    text-align: center;
    margin: 60px auto;
    font-size: 20px;
    color: #9ca3af;
}

/* ---------- Product Page ---------- */

.product-page {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    padding: 70px;
    flex-wrap: wrap;
}

.product-page img {
    width: 420px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, .35);
}

.product-details {
    max-width: 500px;
}

.product-details h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.product-details h2 {
    color: #0d6efd;
    margin-bottom: 20px;
}

.product-details p {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 30px;
}

/* ---------- Cart ---------- */

.page-title {
    text-align: center;
    margin: 40px 0 20px;
}

.cart-items {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.cart-row {
    display: grid;
    grid-template-columns: 80px 1fr auto auto auto;
    align-items: center;
    gap: 20px;
    background: #1f2937;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 15px;
}

.cart-thumb {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.cart-row-info h3 {
    font-size: 18px;
}

.qty-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-form input[type="number"] {
    width: 60px;
    padding: 8px;
    border-radius: 6px;
    border: none;
}

.cart-subtotal {
    font-weight: bold;
    color: #0d6efd;
}

.cart-total {
    text-align: center;
    margin-top: 20px;
}

.cart-actions {
    text-align: center;
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* ---------- Orders ---------- */

.orders-list {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.order-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    gap: 15px;
    background: #1f2937;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 12px;
    text-decoration: none;
    color: white;
    transition: .3s;
}

.order-row:hover {
    transform: translateY(-3px);
}

.order-status {
    color: #22c55e;
    font-weight: bold;
}

.order-meta {
    text-align: center;
    color: #9ca3af;
    margin-bottom: 20px;
}

/* ---------- Admin ---------- */

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    max-width: 900px;
    margin: 20px auto;
    padding: 0 20px;
}

.stat-card {
    background: #1f2937;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #0d6efd;
}

/* ---------- Footer ---------- */

footer {
    background: #000;
    text-align: center;
    padding: 30px;
    margin-top: 40px;
}

/* ---------- Error Pages ---------- */

.error-page {
    text-align: center;
    padding: 100px 20px;
}

.error-page h2 {
    font-size: 72px;
    color: #0d6efd;
    margin-bottom: 20px;
}

.error-page p {
    font-size: 18px;
    margin-bottom: 30px;
}

/* ---------- Auth (Login & Register) ---------- */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 420px;
    background: #1f2937;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
}

.auth-box label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
}

.auth-box input,
.auth-box textarea {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    margin-bottom: 5px;
    font-size: 16px;
    font-family: inherit;
}

.auth-box button {
    width: 100%;
    margin-top: 15px;
}

.auth-box p {
    margin-top: 20px;
    text-align: center;
}

.auth-box a {
    color: #0d6efd;
    text-decoration: none;
}

.field-error {
    color: #f87171;
    font-size: 14px;
    margin-bottom: 8px;
}

/* ---------- Flash messages ---------- */

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

.flash-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    text-align: center;
}

.flash-success {
    background: #198754;
}

.flash-error {
    background: #dc3545;
}

.flash-info {
    background: #0d6efd;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
    }

    nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    nav a {
        margin: 0 10px;
    }

    .hero {
        padding: 60px 20px;
    }

    .hero h2 {
        font-size: 34px;
    }

    .product-page {
        padding: 30px;
    }

    .product-page img {
        width: 280px;
    }

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

    .cart-row,
    .order-row {
        grid-template-columns: 1fr;
        text-align: center;
    }

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