/* ------------------------------------------------------------------
   HONDA GENUINE PARTS - Main Stylesheet
   Theme Color: Honda Red (#E60012)
   ------------------------------------------------------------------ */

:root {
    --honda-red: #E60012;
    --honda-red-hover: #CC0010;
    --honda-dark: #111827;
    --honda-gray-dark: #1F2937;
    --honda-gray-light: #F3F4F6;
    --honda-gray-border: #E5E7EB;
    --honda-text-main: #374151;
    --honda-text-muted: #6B7280;
    --honda-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --honda-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Sarabun', 'Prompt', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: #F8F9FA;
    color: var(--honda-text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Branding Requirement: HONDA MUST BE RED */
.honda-red-text,
.brand-honda {
    color: var(--honda-red) !important;
    font-weight: 800;
}

/* Navbar */
.navbar {
    background-color: var(--honda-dark);
    color: #FFFFFF;
    padding: 0.85rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.navbar-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: #FFFFFF;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.navbar-brand .logo-badge {
    background-color: var(--honda-red);
    color: #FFFFFF;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    list-style: none;
}

.nav-link {
    color: #D1D5DB;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
    color: #FFFFFF;
}

.cart-badge {
    background-color: var(--honda-red);
    color: #FFFFFF;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
}

.btn-auth {
    background-color: var(--honda-red);
    color: #FFFFFF;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-auth:hover {
    background-color: var(--honda-red-hover);
}

.google-auth-section {
    margin-bottom: 1rem;
}

.google-auth-fallback {
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.5rem 1rem;
    border: 1px solid #DADCE0;
    border-radius: 4px;
    background: #FFFFFF;
    color: #3C4043;
    font: 500 0.95rem Arial, sans-serif;
    cursor: pointer;
}

.google-auth-fallback[hidden] {
    display: none !important;
}

.google-auth-fallback:hover {
    background: #F8FAFD;
    border-color: #C6C9CE;
}

.google-mark {
    font-size: 1.1rem;
    font-weight: 700;
    color: #4285F4;
}

#googleSignInButton {
    display: flex;
    justify-content: center;
    min-height: 40px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    color: var(--honda-text-muted);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid #E5E7EB;
}

.user-pill {
    background-color: var(--honda-gray-dark);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: #F3F4F6;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid #374151;
}

.user-role-tag {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.role-admin { background-color: #EF4444; color: #FFF; }
.role-customer { background-color: #10B981; color: #FFF; }

/* Main Container */
.main-content {
    max-width: 1280px;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 1rem;
    flex: 1;
}

/* Hero Section */
.hero-banner {
    background: linear-gradient(135deg, #111827 0%, #1F2937 100%);
    color: #FFFFFF;
    border-radius: 16px;
    padding: 2.2rem 2.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--honda-shadow-lg);
    position: relative;
    overflow: hidden;
    border-left: 6px solid var(--honda-red);
}

.hero-banner::after {
    content: "HONDA";
    position: absolute;
    right: -20px;
    bottom: -30px;
    font-size: 8rem;
    font-weight: 900;
    color: rgba(230, 0, 18, 0.07);
    pointer-events: none;
    letter-spacing: 2px;
}

.hero-title {
    font-size: 1.85rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    color: #9CA3AF;
    font-size: 1rem;
    margin-bottom: 1.25rem;
}

.promo-badge-box {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(230, 0, 18, 0.15);
    border: 1px solid rgba(230, 0, 18, 0.4);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: #F87171;
    font-size: 0.92rem;
    font-weight: 600;
}

/* Search Bar & Category Filter Section */
.search-section {
    background: #FFFFFF;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: var(--honda-shadow);
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.search-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input-group {
    position: relative;
    flex: 1;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--honda-text-muted);
    font-size: 1.1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    border: 1.5px solid var(--honda-gray-border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--honda-red);
    box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.1);
}

.search-count {
    font-size: 0.9rem;
    color: var(--honda-text-muted);
    white-space: nowrap;
}

/* Category Filter Bar */
.category-filter-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--honda-gray-border);
    flex-wrap: wrap;
}

.category-filter-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--honda-dark);
    margin-right: 0.4rem;
}

.category-btn {
    padding: 0.5rem 1.1rem;
    border: 1.5px solid var(--honda-gray-border);
    background: #FFFFFF;
    color: var(--honda-dark);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.category-btn:hover {
    border-color: var(--honda-red);
    color: var(--honda-red);
    background: #FEF2F2;
}

.category-btn.active {
    background: var(--honda-red);
    color: #FFFFFF;
    border-color: var(--honda-red);
    box-shadow: 0 2px 6px rgba(230, 0, 18, 0.3);
}

/* Section Header */
.section-title-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--honda-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 1.25rem;
    background-color: var(--honda-red);
    border-radius: 2px;
}

/* Part Catalog Grid */
.parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.part-card {
    background: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--honda-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--honda-gray-border);
    display: flex;
    flex-direction: column;
}

.part-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--honda-shadow-lg);
    border-color: rgba(230, 0, 18, 0.3);
}

.part-img-wrapper {
    width: 100%;
    height: 180px;
    background-color: #F9FAFB;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--honda-gray-border);
    position: relative;
}

.part-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.part-card:hover .part-img {
    transform: scale(1.05);
}

.part-no-badge {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
    background: rgba(17, 24, 39, 0.85);
    color: #FFFFFF;
    font-size: 0.75rem;
    font-family: monospace;
    padding: 0.25rem 0.55rem;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.part-cat-badge {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.part-cat-car { background: rgba(59, 130, 246, 0.9); color: #FFF; }
.part-cat-mc { background: rgba(230, 0, 18, 0.9); color: #FFF; }

.part-body {
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.part-name {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--honda-dark);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8rem;
}

.part-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--honda-gray-border);
}

.part-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--honda-red);
}

.part-price span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--honda-text-muted);
}

.btn-add-cart {
    background-color: var(--honda-dark);
    color: #FFFFFF;
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-add-cart:hover {
    background-color: var(--honda-red);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: #FFFFFF;
    border-radius: 14px;
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: var(--honda-dark);
    color: #FFFFFF;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: #9CA3AF;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #FFFFFF;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: var(--honda-gray-light);
    border-top: 1px solid var(--honda-gray-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.1rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--honda-dark);
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--honda-gray-border);
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--honda-red);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.btn-primary {
    background-color: var(--honda-red);
    color: #FFFFFF;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--honda-red-hover);
}

.btn-secondary {
    background-color: #E5E7EB;
    color: #374151;
    border: none;
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #D1D5DB;
}

/* Shopping Cart Table */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.cart-table th, .cart-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--honda-gray-border);
    font-size: 0.9rem;
}

.cart-table th {
    background-color: #F9FAFB;
    font-weight: 700;
    color: var(--honda-dark);
}

.cart-qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid var(--honda-gray-border);
    background: #FFFFFF;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

.cart-qty-btn:hover {
    background: var(--honda-gray-light);
}

.cart-qty-val {
    display: inline-block;
    width: 30px;
    text-align: center;
    font-weight: 600;
}

.cart-summary-box {
    background: #F9FAFB;
    border: 1px solid var(--honda-gray-border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.cart-summary-row.total {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--honda-red);
    border-top: 1.5px solid var(--honda-gray-border);
    padding-top: 0.6rem;
    margin-top: 0.6rem;
    margin-bottom: 0;
}

/* Split View Order History */
.split-view-container {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: var(--honda-shadow);
    border: 1px solid var(--honda-gray-border);
    min-height: 520px;
    overflow: hidden;
}

.split-left-pane {
    border-right: 1px solid var(--honda-gray-border);
    background: #F9FAFB;
    display: flex;
    flex-direction: column;
}

.split-left-header {
    padding: 1rem;
    background: var(--honda-dark);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-history-list {
    overflow-y: auto;
    flex: 1;
}

.order-history-item {
    padding: 1rem;
    border-bottom: 1px solid var(--honda-gray-border);
    cursor: pointer;
    transition: background-color 0.15s;
}

.order-history-item:hover {
    background-color: #F3F4F6;
}

.order-history-item.active {
    background-color: #FEF2F2;
    border-left: 4px solid var(--honda-red);
}

.order-item-id {
    font-weight: 700;
    color: var(--honda-dark);
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-item-date {
    font-size: 0.8rem;
    color: var(--honda-text-muted);
    margin-top: 0.2rem;
}

.order-item-total {
    font-weight: 700;
    color: var(--honda-red);
    font-size: 0.95rem;
    margin-top: 0.4rem;
}

.split-right-pane {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Receipt Layout */
.receipt-card {
    background: #FFFFFF;
    border: 1px solid var(--honda-gray-border);
    border-radius: 8px;
    padding: 1.8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.receipt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 1.2rem;
    border-bottom: 2px solid var(--honda-dark);
    margin-bottom: 1.2rem;
}

.receipt-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--honda-dark);
}

.receipt-meta {
    text-align: right;
    font-size: 0.85rem;
    color: var(--honda-text-muted);
}

.receipt-meta-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--honda-dark);
    text-transform: uppercase;
}

.receipt-customer-box {
    background: #F9FAFB;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
}

.receipt-customer-title {
    font-weight: 700;
    color: var(--honda-dark);
    margin-bottom: 0.3rem;
}

.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.2rem;
}

.receipt-table th {
    background: #F3F4F6;
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    border-bottom: 1.5px solid var(--honda-dark);
    text-align: left;
}

.receipt-table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--honda-gray-border);
}

.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

/* Admin Dashboard */
.admin-tab-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--honda-gray-border);
    padding-bottom: 0.5rem;
}

.admin-tab-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--honda-text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.admin-tab-btn.active {
    background: var(--honda-dark);
    color: #FFFFFF;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: var(--honda-shadow);
    border: 1px solid var(--honda-gray-border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--honda-gray-border);
    font-size: 0.9rem;
}

.data-table th {
    background-color: var(--honda-dark);
    color: #FFFFFF;
    font-weight: 700;
}

.data-table tr:hover {
    background-color: #F9FAFB;
}

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger { background: #FEE2E2; color: #991B1B; }

/* Footer */
.footer {
    background-color: var(--honda-dark);
    color: #9CA3AF;
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
    font-size: 0.88rem;
    border-top: 3px solid var(--honda-red);
}

/* Print Friendly Rules */
@media print {
    body * {
        visibility: hidden;
    }
    
    #printableReceipt, #printableReceipt * {
        visibility: visible;
    }

    #printableReceipt {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 20px;
        border: none !important;
        box-shadow: none !important;
        background: #FFFFFF !important;
        color: #000000 !important;
    }

    .no-print,
    .navbar,
    .hero-banner,
    .search-section,
    .split-left-pane,
    .modal-header,
    .modal-footer,
    .btn,
    .btn-primary,
    .btn-secondary,
    .footer {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .split-view-container {
        grid-template-columns: 1fr;
    }
    .split-left-pane {
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--honda-gray-border);
    }
    .navbar-container {
        flex-direction: column;
        gap: 0.8rem;
    }
    .hero-banner {
        padding: 1.5rem;
    }
    .search-row {
        flex-direction: column;
    }
}
