/* =======================================
   NEGOM Brand Official Website - Complete CSS
   Includes: Base, navigation (desktop + mobile hamburger), hero, products, cart, auth, orders, about, contact, alignment fix
   Shopping cart: third-party icon (FontAwesome), no text, positioned at far right on PC, left of hamburger on mobile
   ======================================= */

:root {
    --primary-green: #A4D037;
    --bg-black: #121212;
    --bg-dark: #1a1a1a;
    --text-gray: #e0e0e0;
    --text-dark: #888;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-black);
    color: white;
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

/* ===== Navigation ===== */
nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 5%;
    align-items: center;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    background: var(--bg-black);
    z-index: 1000;
}

.logo {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-green);
    letter-spacing: 2px;
}

.logo a {
    color: inherit; /* 继承父元素的字体颜色 */
    text-decoration: none; /* 去除下划线 */
}

.logo a:hover {
    color: inherit; /* 悬停时也保持颜色不变 */
}

/* 右侧控制区（购物车+汉堡） */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 购物车图标容器（无文字） */
.cart-icon-link {
    position: relative;
    color: white;
    text-decoration: none;
    font-size: 1.4rem;
    display: inline-flex;
    align-items: center;
    transition: 0.3s;
}

.cart-icon-link:hover {
    color: var(--primary-green);
}

/* 购物车计数徽章 – 位于图标右上角 */
.cart-icon-link .cart-count {
    position: absolute;
    top: -8px;
    right: -12px;
    background: var(--primary-green);
    color: black;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
}

/* 桌面端导航链接 */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 30px;
    font-size: 14px;
    transition: 0.3s;
}

.nav-links a:hover {
    color: var(--primary-green);
}

/* 汉堡按钮（默认隐藏，移动端显示） */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* 遮罩层（移动端菜单背景） */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    visibility: hidden;
    opacity: 0;
    transition: 0.3s;
}

.menu-overlay.active {
    visibility: visible;
    opacity: 1;
}

body.menu-open {
    overflow: hidden;
}

/* ===== Hero Section ===== */
.hero {
    display: flex;
    align-items: center;
    padding: 100px 5%;
    background: radial-gradient(circle at right, #2a2a2a, #121212);
}

.hero-text {
    flex: 1;
}

.hero-text h1 {
    font-size: 4rem;
    margin-bottom: 20px;
}

.hero-text h1 span {
    color: var(--primary-green);
}

.hero-text p {
    font-size: 1.2rem;
    color: var(--text-gray);
}

.hero-image {
    flex: 1;
    text-align: right;
}

.hero-image img {
    width: 80%;
    border-radius: 10px;
}

/* ===== Buttons ===== */
.btn-primary {
    background-color: var(--primary-green);
    color: black;
    padding: 15px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    /*margin-top: 20px;*/
    transition: 0.3s;
    border: none;
    cursor: pointer;
    font-size: 1.07rem;
}

.btn-primary:hover {
    background-color: #8cb82e;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-green);
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    border: 1px solid var(--primary-green);
    transition: 0.3s;
    display: inline-block;
}

.btn-secondary:hover {
    background-color: var(--primary-green);
    color: black;
}

.btn-external {
    background-color: #FF9900;
    color: black;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: 0.3s;
    display: inline-block;
}

.btn-external:hover {
    background-color: #e68a00;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.btn-small {
    background-color: var(--primary-green);
    color: black;
    padding: 5px 10px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

.btn-remove {
    color: #ff6b6b;
    text-decoration: none;
    font-size: 14px;
}

.btn-logout {
    background: #dc3545;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
}

/* ===== Products Grid ===== */
.page-header {
    padding: 60px 5% 20px;
    text-align: center;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 40px 5%;
}

.product-card {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: 0.3s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.product-card img {
    height: 200px;
    object-fit: cover;
    border-radius: 5px;
    margin-bottom: 15px;
}

.product-card h3 {
    margin: 10px 0;
}

.product-card .price {
    color: var(--primary-green);
    font-size: 1.3rem;
    font-weight: bold;
}

.product-card .stock {
    font-size: 0.9rem;
    color: #aaa;
    margin: 10px 0;
}

.product-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Product Detail ===== */
.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    padding: 60px 5%;
}

.product-image img {
    width: 100%;
    border-radius: 10px;
}

.product-info .price {
    font-size: 2rem;
    color: var(--primary-green);
    margin: 20px 0;
}

.product-info .stock {
    margin-bottom: 20px;
}

.purchase-options {
    display: flex;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* ===== Cart Page ===== */
.cart-section {
    padding: 60px 5%;
}

.cart-items table {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
}

.cart-items th, .cart-items td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.cart-items th {
    background: var(--bg-dark);
}

.cart-actions {
    display: flex;
    gap: 20px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
}

/* ===== Checkout ===== */
.checkout-section {
    padding: 60px 5%;
}

.checkout-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

.order-summary, .checkout-form {
    background: var(--bg-dark);
    padding: 25px;
    border-radius: 10px;
}

.order-summary table {
    width: 100%;
    margin-top: 15px;
}

.order-summary td {
    padding: 8px 0;
}

.order-summary .total {
    border-top: 1px solid #333;
    font-size: 1.2rem;
    padding-top: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #333;
    background: #2a2a2a;
    color: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-green);
}

/* ===== Auth Pages (Login/Register) ===== */
.auth-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 5%;
}

.auth-container {
    background: var(--bg-dark);
    padding: 40px;
    border-radius: 10px;
    max-width: 450px;
    width: 100%;
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 30px;
}

.field-error {
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 5px;
}

.field-help {
    color: #888;
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    color: #aaa;
}

.auth-footer a {
    color: var(--primary-green);
    text-decoration: none;
}

/* ===== Profile Page ===== */
.profile-section {
    padding: 60px 5%;
}

.profile-card {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 40px;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.avatar-placeholder {
    width: 100px;
    height: 100px;
    background: var(--primary-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: bold;
    color: black;
    margin: 0 auto 20px;
}

.profile-details p {
    margin: 10px 0;
}

.profile-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== Orders List ===== */
.orders-list {
    padding: 20px 5% 60px;
}

.orders-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.order-card {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 20px;
    transition: 0.2s;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
    margin-bottom: 15px;
}

.order-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

.status-pending { background: #ffc107; color: #000; }
.status-paid { background: #17a2b8; color: #fff; }
.status-shipped { background: #007bff; color: #fff; }
.status-completed { background: var(--primary-green); color: #000; }
.status-cancelled { background: #dc3545; color: #fff; }

.order-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.order-total {
    font-weight: bold;
    font-size: 1.2rem;
}

.order-footer {
    text-align: right;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

/* ===== Order Detail ===== */
.order-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    padding: 60px 5% 20px;
}

.order-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 0 5% 30px;
}

.order-items {
    padding: 0 5% 60px;
}

.order-items-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-dark);
    border-radius: 10px;
    overflow: hidden;
}

.order-items-table th,
.order-items-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #333;
}

.order-items-table th {
    background: #222;
}

.order-grand-total td {
    font-size: 1.2rem;
    border-bottom: none;
}

/* ===== About Page ===== */
.about-hero {
    background: linear-gradient(135deg, #1a1a1a, #121212);
    text-align: center;
    padding: 80px 5%;
}

.about-content {
    padding: 60px 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.about-story {
    margin-bottom: 50px;
}

.about-story h2,
.about-values h2 {
    margin-bottom: 20px;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.value-card {
    background: var(--bg-dark);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
}

/* ===== Contact Page ===== */
.contact-hero {
    background: linear-gradient(135deg, #1a1a1a, #121212);
    text-align: center;
    padding: 80px 5%;
}

.contact-content {
    padding: 60px 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.contact-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

.contact-method {
    margin-bottom: 30px;
}

.contact-method strong {
    display: block;
    margin-bottom: 5px;
}

.contact-form-wrapper {
    background: var(--bg-dark);
    padding: 30px;
    border-radius: 10px;
}

.contact-form .form-group {
    margin-bottom: 20px;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #333;
    background: #2a2a2a;
    color: white;
}

/* Contact page icons */
.contact-method i,
.contact-details > h3 i,
.contact-form-wrapper h3 i {
    color: var(--primary-green);
    width: 24px;
    margin-right: 8px;
    text-align: center;
}

.contact-method a {
    color: var(--text-gray);
    text-decoration: none;
    display: inline-block;
    margin: 5px 0;
    transition: 0.3s;
}

.contact-method a:hover {
    color: var(--primary-green);
}

/* ===== Messages (Django Flash Messages) ===== */
.messages {
    padding: 10px 5%;
    max-width: 1200px;
    margin: 0 auto;
}

.message {
    padding: 12px 20px;
    border-radius: 5px;
    margin-bottom: 10px;
}

.message.success {
    background: #28a745;
    color: white;
}

.message.error {
    background: #dc3545;
    color: white;
}

.message.warning {
    background: #ffc107;
    color: black;
}

.message.info {
    background: #17a2b8;
    color: white;
}

/* ===== Features Section (Home) ===== */
.features {
    padding: 30px 5%;
    text-align: center;
}

.features h2 {
    margin-bottom: 40px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--bg-dark);
    padding: 30px;
    border-radius: 10px;
    transition: 0.3s;
}

.feature-card h3 {
    margin-bottom: 15px;
}

.featured-products {
    padding: 25px 5% 80px;
    text-align: center;
}

.featured-products h2 {
    margin-bottom: 40px;
}

/* ===== Footer ===== */
footer {
    background: var(--bg-dark);
    padding: 50px 5% 20px;
    margin-top: 60px;
    position: relative;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section a {
    color: var(--text-gray);
    text-decoration: none;
    display: block;
    margin: 10px 0;
}

.footer-section a:hover {
    color: var(--primary-green);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
    color: var(--text-dark);
}

.footer-manage-link {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    color: white;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 500;
    z-index: 10;
    transition: 0.2s;
}

.footer-manage-link:hover {
    background: rgba(0,0,0,0.8);
    color: #ffaa00;
}

/* ===== Alignment Fix: All main content blocks use 5% padding ===== */
main > section,
.page-header,
.products-list,
.products-grid,
.cart-section,
.auth-section,
.profile-section,
.order-detail-header,
.order-items,
.about-content,
.contact-content,
.checkout-section,
.product-detail-container,
.order-detail-grid,
.orders-container,
.order-card,
.features,
.featured-products,
.messages,
.hero {
    padding-left: 5% !important;
    padding-right: 5% !important;
}

/* Reset margins for headings/paragraphs */
h1, h2, h3, h4, p, .hero-text, .product-info {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Prevent double padding on nested containers */
.product-detail-container,
.order-detail-grid > div,
.contact-info-grid > div {
    padding-left: 0;
    padding-right: 0;
}

/* Hero and page headers already have padding */
.hero, .about-hero, .contact-hero {
    padding-left: 5% !important;
    padding-right: 5% !important;
}

/* ===== Responsive: Mobile Navigation & Adjustments ===== */
@media (max-width: 768px) {
    /* 显示汉堡按钮，隐藏桌面端导航 */
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background: var(--bg-dark);
        flex-direction: column;
        justify-content: flex-start;
        padding: 80px 30px 30px;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -2px 0 10px rgba(0,0,0,0.3);
        gap: 0;
    }

    .nav-links.open {
        right: 0;
    }

    .nav-links a {
        margin: 0;
        font-size: 18px;
        padding: 12px 0;
        width: 100%;
        border-bottom: 1px solid #333;
    }

    /* 移动端：购物车图标保持在汉堡左侧（默认顺序已是） */
    .cart-icon-link {
        margin-right: 0;
    }

    /* 表格滚动 */
    .cart-items table, .order-items-table {
        display: block;
        overflow-x: auto;
    }

    /* 其他布局调整 */
    .hero {
        flex-direction: column;
        text-align: center;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .product-detail-container {
        grid-template-columns: 1fr;
    }

    .order-detail-grid,
    .contact-info-grid,
    .checkout-container {
        grid-template-columns: 1fr;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .order-body {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .cart-actions .btn-primary,
    .cart-actions .btn-secondary {
        text-align: center;
    }

    .footer-manage-link {
        top: 10px;
        right: 10px;
        font-size: 0.75rem;
        padding: 4px 10px;
    }
    .products-grid {
        display: grid;
        grid-template-columns: repeat(1, 1fr);
        gap: 30px;
        padding: 40px 5%;
    }
}