/* --- Fflipp Catalog Plus: Core Theme --- */
/* --- Fflipp Catalog Plus: Rakuten-Style Theme --- */
:root {
    --rakuten-red: #bf1932;
    --nav-gray: #f6f6f6;
    --border-gray: #e0e0e0;
    --text-dark: #333333;
    --text-light: #666666;
}

body.catalog-theme {
    background-color: #ffffff;
    color: var(--text-dark);
    margin: 0;
    font-family: 'Inter', -apple-system, sans-serif;
}

/* 1. Header */
.c-header {
    background: #fff;
    padding: 10px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.c-logo-area {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.c-logo-img {
    height: 28px; /* Slightly more compact for professional look */
    width: auto;
}

.c-logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    color: #003e67;
    white-space: nowrap;
}

.c-logo-plus { color: var(--rakuten-red); font-style: italic; }

/* =========================================
   PROFESSIONAL FLUID GRID (Rakuten Standard)
   ========================================= */

/* 1. Base Grid (Desktop): 6 Cards */
.scroller-container, 
.c-catalog-grid-full {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 20px;
    width: 100%;
    margin-top: 15px;
}

/* 2. Tablets (iPad / 1024px): 3 Cards */
@media (max-width: 1024px) {
    .scroller-container, 
    .c-catalog-grid-full {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 15px;
    }
}

/* 3. Mobile Phones (600px): 2 Cards */
@media (max-width: 600px) {
    .scroller-container, 
    .c-catalog-grid-full {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 12px;
    }
}

/* --- CARD POLISH (Fixing "Various Sizes" issue) --- */
.zine-card {
    display: flex !important;
    flex-direction: column !important;
    text-decoration: none !important;
    width: 100%;
    min-width: 0; /* Prevents overflow */
}

.zine-cover-wrapper {
    width: 100%;
    /* ENFORCE UNIFORM SIZE: This forces all covers to be the same height */
    aspect-ratio: 3 / 4 !important; 
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative;
}

.zine-cover-img {
    width: 100%;
    height: 100%;
    /* This ensures images fill the 3:4 box without stretching */
    object-fit: cover !important; 
}

.zine-info {
    padding: 10px 0;
}

.zine-info h3 {
    font-size: 0.9rem;
    line-height: 1.3;
    margin: 0;
    color: #1e3a8a;
    font-weight: 700;
    /* Truncate long titles to 1 line */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Merchant Tag styling for consistency */
.merchant-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.merchant-name {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

/* --- FULL LIST DROPDOWN STYLING --- */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    z-index: 9999 !important; /* MUST BE HIGHEST to overlap search bar */
    padding: 10px 0;
}

.dropdown-wrapper:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
}

.dropdown-menu a:hover {
    background: #f8fafc;
    color: #bf1932;
}

/* --- AVATAR & LOGIN STYLING --- */
.c-avatar-trigger {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Clips the image into a circle */
    background: #f8fafc;
    text-decoration: none;
    transition: border-color 0.2s;
}

.c-avatar-trigger:hover {
    border-color: var(--rakuten-red);
}

.c-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.c-avatar-emoji {
    font-size: 1.4rem;
    line-height: 1;
}

.c-login-link {
    display: flex;
    align-items: center;
    transition: transform 0.2s;
}

.c-login-link:hover {
    transform: scale(1.1);
}

/* 2. Gray Navigation Bar */
.c-quick-nav {
    background-color: var(--nav-gray);
    border-bottom: 1px solid var(--border-gray);
    padding: 0 15px;
    height: 50px;
    display: flex;
    align-items: center;
    overflow-x: auto; /* Enable horizontal swipe */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

.nav-links {
    display: flex;
    gap: 20px;
    margin: 0 auto; /* Centers on desktop, allows pull-left on mobile */
}

.nav-links a { 
    text-decoration: none; 
    color: #555; 
    font-size: 0.8rem; 
    font-weight: 700; 
    white-space: nowrap; 
    text-transform: uppercase;
    transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active { color: var(--rakuten-red); border-bottom: 2px solid var(--rakuten-red); }

/* Hide scrollbar but keep functionality */
.c-quick-nav::-webkit-scrollbar { display: none; }
.c-quick-nav { -ms-overflow-style: none; scrollbar-width: none; }

/* 3. Search Bar Area */
.c-search-section { padding: 20px 40px; background: #fff; position: relative;
    z-index: 500; /* Lower than the navigation dropdown */ }
.c-search-container {
    max-width: 850px; 
    margin: 0 auto; 
    display: flex;
    align-items: center;
    border: 1px solid #ccc; /* Changed to grey */
    border-radius: 4px; 
    overflow: hidden;
    background: #fff;
}

.c-search-logo {
    padding: 0 15px;
    height: 24px;
    border-right: 1px solid #eee;
}

.c-search-container input { 
    flex: 1; 
    border: none; 
    padding: 12px 15px; 
    outline: none; 
    font-size: 1rem; 
}

.c-search-container button { 
    background: var(--rakuten-red); 
    color: white; 
    border: none; 
    width: 60px; /* Square button for SVG */
    height: 50px;
    cursor: pointer; 
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 4. Promo Carousel */
/* --- RAKUTEN-STYLE SLIDER --- */
.c-slider-container {
    width: calc(100% - 40px);
    max-width: 1200px;
    margin: 20px auto;
    border-radius: 12px;
    overflow: hidden; /* Hide the extra banners */
    position: relative;
    aspect-ratio: 3 / 1; /* Matches 1200x400 */
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.c-slider-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth slide */
}

.c-slide {
    min-width: 100%;
    height: 100%;
}

.c-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Dots Navigation */
.c-slider-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0,0,0,0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.dot.active {
    background: var(--rakuten-red);
    width: 25px; /* Pill shape for the active slide */
    border-radius: 10px;
}

@media (max-width: 768px) {
    .c-slider-container { aspect-ratio: 2 / 1; width: calc(100% - 20px); }
}

/* 5. 2-Column Layout */
.catalog-layout {
    display: flex; max-width: 1400px; margin: 40px auto; padding: 0 40px; gap: 30px;
}

/* Sidebar */
.c-sidebar { width: 260px; flex-shrink: 0; }
.c-side-link {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    text-decoration: none; color: var(--text-dark); border-bottom: 1px solid var(--nav-gray);
    font-size: 0.9rem; transition: background 0.2s;
}
.c-side-link:hover { background: var(--nav-gray); color: var(--rakuten-red); }
.c-side-link svg { width: 20px; height: 20px; fill: #666; }

/* Main rows */
.c-main-content { flex: 1; min-width: 0; }
.c-row-section { margin-bottom: 40px; }
.c-row-title { font-size: 1.2rem; font-weight: 800; border-bottom: 2px solid var(--rakuten-red); padding-bottom: 8px; margin-bottom: 20px; }

/* Responsive */
@media (max-width: 1024px) {
    .c-sidebar { display: none; }
    .c-header, .c-quick-nav { padding: 10px 20px; }
}

/* --- GRID FOR FILTERED RESULTS --- */
.c-catalog-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 25px;
    width: 100%;
}

/* Card Improvements */
.zine-card { transition: transform 0.3s ease; }
.zine-card:hover { transform: translateY(-5px); }
.merchant-tag { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.merchant-name { font-size: 0.75rem; color: #64748b; font-weight: 600; }

/* 6. MERCHANT SECTION (White Theme) */
.c-merchant-section {
    background: #ffffff;
    border-top: 1px solid var(--border-gray);
    padding: 60px 20px;
    text-align: center;
}

.c-merchant-section h2 {
    color: var(--text-dark);
    font-size: 2rem;
    margin: 0 0 10px 0;
    font-weight: 800;
}

.c-merchant-btn {
    background: var(--rakuten-red);
    color: #ffffff;
    padding: 15px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.1rem;
    display: inline-block;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(191, 25, 50, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.c-merchant-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(191, 25, 50, 0.3);
}

/* 7. HEADER AVATAR */
.c-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 1px solid var(--border-gray);
    display: block;
}

/* --- MERCHANT DROPDOWN (Light Theme) --- */

#c-profile-dropdown {
    z-index: 10000 !important;
}

.c-profile-wrapper { position: relative; }
.c-profile-btn { width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 1px solid #ddd; cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 0; }
.c-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.c-avatar-emoji { font-size: 1.4rem; }

.c-dropdown-content {
    display: none; position: absolute; right: 0; top: 45px;
    background-color: #ffffff; min-width: 200px;
    border-radius: 8px; border: 1px solid #ddd;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); z-index: 5000;
    padding: 10px 0;
}
.c-dropdown-content.show { display: block; }
.c-dropdown-content a {
    color: #333; padding: 10px 20px; text-decoration: none;
    display: flex; align-items: center; gap: 12px; font-size: 0.9rem; font-weight: 600;
}
.c-dropdown-content a:hover { background-color: #f8fafc; color: #bf1932; }
.c-dropdown-header { padding: 10px 20px; border-bottom: 1px solid #eee; margin-bottom: 5px; font-size: 0.8rem; color: #999; }

/* --- ICON SCALING FIX --- */
.menu-icon {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0;
    fill: #666;
}

.c-dropdown-content a:hover .menu-icon {
    fill: var(--rakuten-red);
}

.c-page-link {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-weight: 700;
    transition: all 0.2s;
}

.c-page-link.active {
    background-color: var(--rakuten-red);
    color: white;
    border-color: var(--rakuten-red);
}

.c-page-link:hover:not(.active) {
    border-color: var(--rakuten-red);
    color: var(--rakuten-red);
}

