/* ===========================================
   Tamiya Pre-Order Shop - Styles
   Theme: Tamiya Blue/Red/White
   =========================================== */

/* CSS Variables */
:root {
    --tamiya-blue: #0046AD;
    --tamiya-blue-dark: #003789;
    --tamiya-red: #E60012;
    --tamiya-red-dark: #C4000F;
    --tamiya-white: #FFFFFF;
    --tamiya-light-gray: #F5F5F5;
    --tamiya-gray: #E0E0E0;
    --tamiya-text: #333333;
    --tamiya-text-light: #666666;
    --tamiya-shadow: 0 4px 15px rgba(0, 70, 173, 0.15);
    --tamiya-shadow-hover: 0 8px 25px rgba(0, 70, 173, 0.25);
}

/* Shop Page Layout */
.tamiya-shop-page {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--tamiya-light-gray);
    min-height: 100vh;
}

/* Header */
.tamiya-header {
    background: var(--tamiya-blue);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tamiya-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tamiya-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tamiya-logo img {
    height: 45px;
    width: auto;
}

.tamiya-logo h1 {
    color: var(--tamiya-white);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.tamiya-logo span {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

/* Cart Button */
.cart-button {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--tamiya-red);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.cart-button:hover {
    background: var(--tamiya-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(230, 0, 18, 0.4);
}

.cart-count {
    background: var(--tamiya-white);
    color: var(--tamiya-red);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Hero Banner */
.tamiya-hero {
    background: linear-gradient(135deg, var(--tamiya-blue) 0%, var(--tamiya-blue-dark) 100%);
    padding: 60px 0;
    text-align: center;
    color: white;
}

.tamiya-hero h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.tamiya-hero p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Category Tabs */
.category-tabs {
    background: var(--tamiya-white);
    padding: 20px 0;
    border-bottom: 2px solid var(--tamiya-gray);
}

.category-tabs .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.category-tab {
    padding: 12px 28px;
    border: 2px solid var(--tamiya-blue);
    background: var(--tamiya-white);
    color: var(--tamiya-blue);
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-tab:hover,
.category-tab.active {
    background: var(--tamiya-blue);
    color: var(--tamiya-white);
}

/* Products Grid */
.products-section {
    padding: 50px 0;
}

.products-section .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

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

/* Product Card */
.product-card {
    background: var(--tamiya-white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--tamiya-shadow);
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--tamiya-shadow-hover);
}

.product-image {
    width: 100%;
    height: 220px;
    object-fit: contain;
    background: var(--tamiya-light-gray);
    padding: 20px;
}

.product-info {
    padding: 20px;
}

.product-category {
    display: inline-block;
    background: var(--tamiya-blue);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.product-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tamiya-text);
    margin-bottom: 8px;
    line-height: 1.4;
    min-height: 45px;
}

.product-code {
    font-size: 0.85rem;
    color: var(--tamiya-text-light);
    margin-bottom: 15px;
}

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

/* Sale Styles */
.product-card {
    position: relative;
}

.sale-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--tamiya-red);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(230, 0, 18, 0.4);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

.product-price-original {
    font-size: 1rem;
    color: var(--tamiya-text-light);
    margin-bottom: 2px;
}

.product-price-original s {
    text-decoration: line-through;
}

.product-price.sale {
    color: #e53e3e;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.btn-add-cart {
    width: 100%;
    padding: 14px;
    background: var(--tamiya-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-add-cart:hover {
    background: var(--tamiya-blue-dark);
}

.btn-add-cart.added {
    background: #28a745;
}

/* Product Buttons */
.product-buttons {
    display: flex;
    gap: 10px;
}

.btn-view-detail {
    flex: 1;
    padding: 12px 10px;
    background: white;
    color: var(--tamiya-blue);
    border: 2px solid var(--tamiya-blue);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-view-detail:hover {
    background: var(--tamiya-blue);
    color: white;
}

.product-buttons .btn-add-cart {
    flex: 1;
    padding: 12px 10px;
    font-size: 0.9rem;
}

.product-image-link {
    display: block;
}

/* Cart Sidebar */
.cart-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.cart-overlay.active {
    display: block;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    max-width: 100%;
    height: 100%;
    background: var(--tamiya-white);
    z-index: 2001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.active {
    right: 0;
}

.cart-header {
    background: var(--tamiya-blue);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.cart-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--tamiya-gray);
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: var(--tamiya-light-gray);
    border-radius: 8px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.cart-item-price {
    color: var(--tamiya-red);
    font-weight: 600;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--tamiya-gray);
    background: white;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
}

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

.cart-item-remove {
    color: var(--tamiya-red);
    cursor: pointer;
    font-size: 0.85rem;
}

.cart-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--tamiya-text-light);
}

.cart-footer {
    padding: 20px;
    border-top: 2px solid var(--tamiya-gray);
    background: var(--tamiya-light-gray);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.cart-total span:last-child {
    color: var(--tamiya-red);
}

.btn-checkout {
    width: 100%;
    padding: 16px;
    background: var(--tamiya-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-checkout:hover {
    background: var(--tamiya-red-dark);
}

.btn-checkout:disabled {
    background: var(--tamiya-gray);
    cursor: not-allowed;
}

/* Checkout Page */
.checkout-section {
    padding: 50px 0;
}

.checkout-section .container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.checkout-form {
    background: var(--tamiya-white);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--tamiya-shadow);
}

.checkout-form h3 {
    color: var(--tamiya-blue);
    margin-bottom: 25px;
    font-size: 1.3rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--tamiya-text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--tamiya-gray);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--tamiya-blue);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.order-summary {
    background: var(--tamiya-white);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--tamiya-shadow);
}

.order-summary h3 {
    color: var(--tamiya-blue);
    margin-bottom: 25px;
    font-size: 1.3rem;
}

.order-items {
    max-height: 300px;
    overflow-y: auto;
}

.order-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--tamiya-gray);
}

.order-item-name {
    font-weight: 500;
}

.order-item-qty {
    color: var(--tamiya-text-light);
    font-size: 0.9rem;
}

.order-item-price {
    font-weight: 600;
    color: var(--tamiya-red);
}

.order-total {
    display: flex;
    justify-content: space-between;
    padding: 20px 0;
    font-size: 1.4rem;
    font-weight: 700;
    border-top: 2px solid var(--tamiya-blue);
    margin-top: 20px;
}

.order-total span:last-child {
    color: var(--tamiya-red);
}

.btn-submit-order {
    width: 100%;
    padding: 18px;
    background: var(--tamiya-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.btn-submit-order:hover {
    background: var(--tamiya-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(230, 0, 18, 0.4);
}

.btn-submit-order:disabled {
    background: var(--tamiya-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Success Message */
.order-success {
    text-align: center;
    padding: 60px 20px;
    background: var(--tamiya-white);
    border-radius: 16px;
    box-shadow: var(--tamiya-shadow);
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.order-success h2 {
    color: #28a745;
    margin-bottom: 15px;
}

.order-success p {
    color: var(--tamiya-text-light);
    margin-bottom: 30px;
}

.btn-continue {
    display: inline-block;
    padding: 14px 40px;
    background: var(--tamiya-blue);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-continue:hover {
    background: var(--tamiya-blue-dark);
}

/* Banner Styles for index.php */
.tamiya-banner {
    background: linear-gradient(135deg, var(--tamiya-blue) 0%, #003080 100%);
    padding: 60px 0;
    position: relative;
    overflow: hidden;
}

.tamiya-banner::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: var(--tamiya-red);
    clip-path: polygon(30% 0, 100% 0, 100% 100%, 0% 100%);
}

.tamiya-banner .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.tamiya-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.tamiya-banner-text {
    color: white;
    max-width: 600px;
}

.tamiya-banner-text h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.tamiya-banner-text h2 img {
    height: 50px;
}

.tamiya-banner-text p {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 25px;
    line-height: 1.7;
}

.btn-tamiya-shop {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--tamiya-white);
    color: var(--tamiya-blue);
    padding: 16px 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-tamiya-shop:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.tamiya-banner-image {
    flex-shrink: 0;
}

.tamiya-banner-image img {
    max-width: 300px;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

/* Footer */
.tamiya-footer {
    background: var(--tamiya-blue-dark);
    color: white;
    padding: 30px 0;
    text-align: center;
}

.tamiya-footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.tamiya-footer a:hover {
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .tamiya-header .container {
        flex-direction: column;
        gap: 15px;
    }

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

    .tamiya-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .tamiya-banner::before {
        display: none;
    }

    .tamiya-banner-text h2 {
        justify-content: center;
        font-size: 1.6rem;
    }

    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #28a745;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3000;
}

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

.toast.error {
    background: var(--tamiya-red);
}

/* ========== Enhanced Mobile Responsive ========== */
@media (max-width: 768px) {

    /* Header Mobile */
    .tamiya-header {
        padding: 15px 0;
    }

    .tamiya-header .container {
        flex-direction: row;
        justify-content: space-between;
        padding: 0 15px;
    }

    .tamiya-logo {
        gap: 10px;
    }

    .tamiya-logo img {
        height: 35px;
    }

    .tamiya-logo h1 {
        font-size: 1.1rem;
    }

    .tamiya-logo span {
        font-size: 0.7rem;
    }

    .cart-button {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    /* Hero Mobile */
    .tamiya-hero {
        padding: 40px 20px;
    }

    .tamiya-hero h2 {
        font-size: 1.6rem;
    }

    .tamiya-hero p {
        font-size: 1rem;
    }

    /* Category Tabs Mobile */
    .category-tabs {
        padding: 15px 0;
    }

    .category-tabs .container {
        padding: 0 10px;
        gap: 8px;
    }

    .category-tab {
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    /* Products Grid Mobile */
    .products-section {
        padding: 30px 0;
    }

    .products-section .container {
        padding: 0 15px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .product-card {
        border-radius: 12px;
    }

    .product-image {
        height: 140px;
        padding: 10px;
    }

    .product-info {
        padding: 12px;
    }

    .product-category {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    .product-name {
        font-size: 0.85rem;
        min-height: 38px;
    }

    .product-code {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }

    .product-price {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .btn-add-cart {
        padding: 10px;
        font-size: 0.85rem;
    }

    /* Cart Sidebar Mobile */
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .cart-header {
        padding: 15px;
    }

    .cart-header h3 {
        font-size: 1.1rem;
    }

    .cart-items {
        padding: 15px;
    }

    .cart-item {
        gap: 10px;
        padding: 12px 0;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
    }

    .cart-item-name {
        font-size: 0.9rem;
    }

    .cart-footer {
        padding: 15px;
    }

    .cart-total {
        font-size: 1.1rem;
    }

    .btn-checkout {
        padding: 14px;
        font-size: 1rem;
    }

    /* Checkout Mobile */
    .checkout-section {
        padding: 30px 0;
    }

    .checkout-section .container {
        padding: 0 15px;
    }

    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .checkout-form,
    .order-summary {
        padding: 20px;
    }

    .checkout-form h3,
    .order-summary h3 {
        font-size: 1.15rem;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 12px;
        font-size: 0.95rem;
    }

    .order-total {
        font-size: 1.2rem;
    }

    .btn-submit-order {
        padding: 16px;
        font-size: 1.05rem;
    }

    /* Toast Mobile */
    .toast {
        bottom: 20px;
        right: 15px;
        left: 15px;
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* Footer Mobile */
    .tamiya-footer {
        padding: 20px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {

    /* Extra small screens */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .product-card {
        display: flex;
        flex-direction: row;
    }

    .product-image {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
    }

    .product-info {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .product-name {
        min-height: auto;
    }

    .tamiya-hero h2 {
        font-size: 1.4rem;
    }

    .category-tab {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}