/* ==========================================================================
   YiwuPage Runtime Company — CSS Layer
   Task 024-C | 2026-07-29
   Mobile-First Company UI System
   ========================================================================== */

/* --- Design Tokens --- */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --gold: #b45309;
    --gold-bg: #fffbeb;
    --market-bg: #f0f9ff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: 0.2s ease;
}

/* --- Base Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Malgun Gothic', 'Noto Sans KR', 'Noto Sans SC', sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

/* ==========================================================================
   HEADER
   ========================================================================== */
.yp-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.95);
}
.yp-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.yp-header-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
    letter-spacing: -0.5px;
}
.yp-header-logo span { color: var(--primary); }
.yp-header-nav { display: flex; gap: 16px; align-items: center; }
.yp-header-nav a { color: var(--gray-600); font-size: 13px; font-weight: 500; }
.yp-header-nav a:hover { color: var(--primary); }
.yp-runtime-badge {
    background: var(--warning-light);
    color: var(--gold);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ==========================================================================
   BREADCRUMB
   ========================================================================== */
.yp-breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 16px 0;
    font-size: 12px;
    color: var(--gray-400);
}
.yp-breadcrumb a { color: var(--gray-400); }
.yp-breadcrumb a:hover { color: var(--primary); }
.yp-breadcrumb .sep { margin: 0 5px; color: var(--gray-300); }

/* ==========================================================================
   ADVERTISEMENT SLOTS
   ========================================================================== */
.yp-ad-slot {
    max-width: 1200px;
    margin: 12px auto;
    padding: 0 16px;
}
.yp-ad-slot-inner {
    background: var(--gray-100);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 12px;
}
.yp-ad-slot-sidebar {
    background: var(--gray-100);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 11px;
    margin-bottom: 12px;
}

/* ==========================================================================
   COMPANY DETAIL — MAIN LAYOUT
   ========================================================================== */
.yp-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* --- Company Hero Card --- */
.yp-company-hero {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.yp-hero-top {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.yp-hero-logo {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    object-fit: cover;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}
.yp-hero-logo-placeholder {
    width: 72px;
    height: 72px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary-light), var(--market-bg));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--primary);
    flex-shrink: 0;
    font-weight: 700;
}
.yp-hero-info { flex: 1; min-width: 0; }
.yp-hero-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.yp-hero-badges { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* --- Badges --- */
.yp-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.4;
}
.yp-badge-verified {
    background: var(--success-light);
    color: var(--success);
}
.yp-badge-vip {
    background: var(--gold-bg);
    color: var(--gold);
}
.yp-badge-featured {
    background: var(--primary-light);
    color: var(--primary);
}
.yp-badge-premium {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* VIP Stars */
.yp-vip-stars { color: var(--warning); letter-spacing: 1px; font-size: 12px; }

/* --- Hero Meta --- */
.yp-hero-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.yp-meta-item {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}
.yp-meta-item i { color: var(--gray-400); font-size: 13px; }

/* --- CTA Buttons --- */
.yp-cta-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 4px;
}
.yp-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
}
.yp-cta-btn i { font-size: 16px; }
.yp-cta-call {
    background: var(--success);
    color: var(--white);
}
.yp-cta-call:hover { background: #15803d; color: var(--white); }
.yp-cta-wechat {
    background: #07c160;
    color: var(--white);
}
.yp-cta-wechat:hover { background: #06ae56; color: var(--white); }
.yp-cta-inquiry {
    background: var(--primary);
    color: var(--white);
}
.yp-cta-inquiry:hover { background: var(--primary-dark); color: var(--white); }

/* ==========================================================================
   CONTENT SECTIONS
   ========================================================================== */
.yp-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}
.yp-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}
.yp-section-content {
    color: var(--gray-600);
    font-size: 14px;
    line-height: 1.8;
}
.yp-section-content p { margin-bottom: 8px; }

/* Feature Tags */
.yp-feature-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.yp-feature-tag {
    background: var(--market-bg);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--primary-light);
}

/* ==========================================================================
   CONTACT INFO
   ========================================================================== */
.yp-contact-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}
.yp-contact-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--gray-800);
}
.yp-contact-list { display: flex; flex-direction: column; gap: 8px; }
.yp-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
}
.yp-contact-item i {
    color: var(--primary);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    margin-top: 2px;
    font-size: 14px;
}
.yp-contact-label { color: var(--gray-500); min-width: 44px; font-size: 12px; }
.yp-contact-value { color: var(--gray-700); word-break: break-all; }
.yp-contact-value a { color: var(--primary); }

/* ==========================================================================
   COMPANY CARDS (Related / Sidebar)
   ========================================================================== */
.yp-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    border: 1px solid var(--gray-100);
}
.yp-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.yp-card-link {
    display: flex;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    align-items: center;
}
.yp-card-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}
.yp-card-logo-ph {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary-light), var(--market-bg));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--primary);
    flex-shrink: 0;
    font-weight: 600;
}
.yp-card-info { min-width: 0; flex: 1; }
.yp-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}
.yp-card-desc {
    font-size: 11px;
    color: var(--gray-500);
    line-height: 1.4;
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.yp-sidebar { display: flex; flex-direction: column; gap: 12px; }
.yp-sidebar-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.yp-sidebar-box h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}
.yp-sidebar-box .yp-card { margin-bottom: 8px; }
.yp-sidebar-box .yp-card:last-child { margin-bottom: 0; }

/* ==========================================================================
   RELATED COMPANIES (Grid)
   ========================================================================== */
.yp-related-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ==========================================================================
   COMPANY LIST PAGE
   ========================================================================== */
.yp-list-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 0;
}
.yp-list-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
}
.yp-list-header p {
    color: var(--gray-500);
    font-size: 13px;
    margin-top: 3px;
}
.yp-cat-nav {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.yp-cat-nav::-webkit-scrollbar { display: none; }
.yp-cat-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    gap: 2px;
    white-space: nowrap;
}
.yp-cat-nav-item {
    display: inline-block;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.yp-cat-nav-item:hover { color: var(--primary); border-bottom-color: var(--gray-300); }
.yp-cat-nav-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.yp-cat-count { font-size: 10px; color: var(--gray-400); margin-left: 2px; }

.yp-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
.yp-company-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, 1fr);
}
.yp-grid-empty {
    text-align: center;
    padding: 40px;
    color: var(--gray-400);
    font-size: 14px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.yp-footer {
    max-width: 1200px;
    margin: 32px auto 0;
    padding: 20px 16px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    font-size: 11px;
    color: var(--gray-400);
}
.yp-footer p { margin-bottom: 2px; }

/* ==========================================================================
   MOBILE BOTTOM CTA BAR (Sticky)
   ========================================================================== */
.yp-mobile-cta {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 8px 16px;
    z-index: 99;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}
.yp-mobile-cta-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.yp-mobile-cta .yp-cta-btn {
    padding: 12px 8px;
    font-size: 13px;
    border-radius: var(--radius);
}

/* ==========================================================================
   RESPONSIVE — TABLET (768px+)
   ========================================================================== */
@media (min-width: 768px) {
    .yp-detail-container {
        grid-template-columns: 1fr 280px;
        padding: 20px;
    }
    .yp-company-hero {
        padding: 24px;
    }
    .yp-hero-top { gap: 20px; }
    .yp-hero-logo, .yp-hero-logo-placeholder {
        width: 88px;
        height: 88px;
        font-size: 34px;
    }
    .yp-hero-name { font-size: 24px; }
    .yp-cta-bar { grid-template-columns: repeat(3, 1fr); }
    .yp-related-grid { grid-template-columns: repeat(4, 1fr); }
    .yp-company-grid { grid-template-columns: repeat(3, 1fr); }
    .yp-grid-container { grid-template-columns: 1fr 260px; }
    .yp-sidebar { position: sticky; top: 70px; align-self: start; }
    .yp-list-header h1 { font-size: 24px; }
}

/* ==========================================================================
   RESPONSIVE — DESKTOP (1024px+)
   ========================================================================== */
@media (min-width: 1024px) {
    .yp-hero-logo, .yp-hero-logo-placeholder {
        width: 100px;
        height: 100px;
        font-size: 38px;
    }
    .yp-hero-name { font-size: 26px; }
    .yp-company-hero { padding: 28px 32px; }
    .yp-section { padding: 24px; }
    .yp-company-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}

/* ==========================================================================
   RESPONSIVE — MOBILE (under 768px)
   ========================================================================== */
@media (max-width: 767px) {
    .yp-header-inner { padding: 0 12px; }
    .yp-header-nav { gap: 10px; }
    .yp-header-nav a { font-size: 12px; }
    
    .yp-company-hero { padding: 16px; }
    .yp-hero-top { gap: 12px; }
    .yp-hero-logo, .yp-hero-logo-placeholder {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    .yp-hero-name { font-size: 17px; }
    .yp-hero-meta { gap: 8px; }
    .yp-meta-item { font-size: 11px; }
    
    .yp-cta-bar { display: none; }
    .yp-mobile-cta { display: block; }
    
    /* Add bottom padding to body for mobile CTA bar */
    body.yp-detail-page { padding-bottom: 72px; }
    
    .yp-section { padding: 16px; margin-bottom: 8px; }
    .yp-section-title { font-size: 14px; }
    .yp-section-content { font-size: 13px; }
    
    .yp-company-grid { grid-template-columns: 1fr; }
    .yp-related-grid { grid-template-columns: repeat(2, 1fr); }
    
    .yp-sidebar { display: none; }
    .yp-ad-slot-sidebar { display: none; }
    
    .yp-footer { margin-top: 16px; padding: 16px; }
}

/* ==========================================================================
   UTILITY
   ========================================================================== */
.yp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ==========================================
 * Task 025 — Advertisement Styles
 * ========================================== */
.yp-ad-slot {
  margin: 12px 0;
  text-align: center;
}
.yp-ad-slot-inner {
  display: inline-block;
  min-height: 60px;
  background: #f8f9fa;
  border: 1px dashed #dee2e6;
  border-radius: 8px;
  padding: 8px;
}
.yp-ad-slot-empty .yp-ad-slot-inner {
  opacity: 0.3;
}
.yp-ad-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
  transition: background 0.2s;
  position: relative;
}
.yp-ad-item:hover {
  background: #e9ecef;
}
.yp-ad-content { flex: 1; min-width: 0; }
.yp-ad-item-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #212529;
  margin-bottom: 2px;
}
.yp-ad-item-desc {
  display: block;
  font-size: 12px;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.yp-ad-label {
  font-size: 10px;
  color: #adb5bd;
  background: #f1f3f5;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-left: 8px;
}
.yp-ad-slot-sidebar { margin-bottom: 16px; }
.yp-ad-sidebar-item { margin-bottom: 12px; }
.yp-ad-sidebar-item .yp-ad-link {
  display: block;
  padding: 12px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.2s;
  position: relative;
}
.yp-ad-sidebar-item .yp-ad-link:hover { border-color: #ffc107; }
.yp-ad-sidebar-item .yp-ad-title {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: #212529;
  margin-bottom: 4px;
}
.yp-ad-sidebar-item .yp-ad-desc {
  display: block;
  font-size: 12px;
  color: #6c757d;
  line-height: 1.4;
}
.yp-ad-sidebar-item .yp-ad-label {
  position: absolute;
  top: 8px;
  right: 8px;
}
.yp-ad-inline { margin: 16px 0; text-align: center; }
@media (max-width: 767px) {
  .yp-ad-slot-inner { width: 100%; min-height: 50px; }
  .yp-ad-item { padding: 8px 12px; }
  .yp-ad-item-title { font-size: 13px; }
  .yp-ad-item-desc { font-size: 11px; }
}
