/* Components CSS - 폼폼 쇼핑몰 */

/* Loading Components */
.loading {
    position: fixed;
    inset: 0;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 1px;
}

.spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 3px;
}

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

/* Mode Switcher 제거됨 */

/* Mode Containers */
.mode-container {
    display: none;
    min-height: 100vh;
}

.mode-container.active {
    display: block;
}

/* Navigation */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4rem;
}

.nav-brand {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-normal);
    padding: var(--space-2) 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

/* Search Component */
.search-container {
    flex: 1;
    max-width: 24rem;
    margin: 0 var(--space-8);
    position: relative;
}

.search-input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) 2.5rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    transition: var(--transition-normal);
    background: var(--gray-50);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.search-icon {
    position: absolute;
    left: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    font-size: var(--font-size-lg);
}

/* Button Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    border: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-xs {
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-size-xs);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-lg);
}

.btn-xl {
    padding: var(--space-6) var(--space-12);
    font-size: var(--font-size-xl);
    border-radius: var(--radius-lg);
}

/* Button Variants */
.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-error {
    background: var(--error);
    color: var(--white);
}

.btn-error:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-700);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-link {
    background: transparent;
    color: var(--primary);
    border: none;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* Card Components */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition-normal);
    cursor: pointer;
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-static {
    cursor: default;
}

.card-static:hover {
    transform: none;
    border-color: var(--gray-200);
}

.card-header {
    padding: var(--space-6) var(--space-6) 0;
}

.card-body {
    padding: var(--space-4) var(--space-6);
}

.card-footer {
    padding: 0 var(--space-6) var(--space-6);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--gray-100);
}

/* Hero Component */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    padding: var(--space-16) 0;
    text-align: center;
}

.hero h1 {
    font-size: var(--font-size-5xl);
    font-weight: 700;
    margin-bottom: var(--space-4);
    line-height: 1.1;
}

.hero p {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-8);
    opacity: 0.9;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

/* Form Components */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    transition: var(--transition-normal);
    background: var(--white);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.form-input.error {
    border-color: var(--error);
}

.form-error {
    color: var(--error);
    font-size: var(--font-size-xs);
    margin-top: var(--space-1);
}

.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    background: var(--white);
    cursor: pointer;
    transition: var(--transition-normal);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

/* Modal Components */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-4);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: var(--space-6) var(--space-6) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    padding: var(--space-2);
    border: none;
    background: none;
    cursor: pointer;
    color: var(--gray-400);
    font-size: var(--font-size-xl);
    border-radius: var(--radius-md);
    transition: var(--transition-normal);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: 0 var(--space-6) var(--space-6);
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
}

/* Alert Components */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid;
    margin-bottom: var(--space-4);
}

.alert-info {
    background: rgb(59 130 246 / 0.1);
    border-color: var(--info);
    color: #1e40af;
}

.alert-success {
    background: rgb(16 185 129 / 0.1);
    border-color: var(--success);
    color: #065f46;
}

.alert-warning {
    background: rgb(245 158 11 / 0.1);
    border-color: var(--warning);
    color: #92400e;
}

.alert-error {
    background: rgb(239 68 68 / 0.1);
    border-color: var(--error);
    color: #991b1b;
}

/* Badge Components */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.badge-primary {
    background: var(--primary);
    color: var(--white);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.badge-success {
    background: var(--success);
    color: var(--white);
}

.badge-error {
    background: var(--error);
    color: var(--white);
}

.badge-warning {
    background: var(--warning);
    color: var(--white);
}

/* Progress Components */
.progress {
    width: 100%;
    height: var(--space-2);
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-bar-success {
    background: var(--success);
}

.progress-bar-warning {
    background: var(--warning);
}

.progress-bar-error {
    background: var(--error);
}

/* Table Components */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-900);
}

.table tr:hover {
    background: var(--gray-50);
}

/* Tooltip Components */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: var(--white);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
    z-index: 1000;
}

.tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

/* Responsive Components */
@media (max-width: 640px) {
    
    .nav-links {
        display: none;
    }
    
    .search-container {
        margin: 0 var(--space-4);
    }
    
    .hero h1 {
        font-size: var(--font-size-3xl);
    }
    
    .hero p {
        font-size: var(--font-size-lg);
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        margin: var(--space-4);
        max-width: calc(100vw - 2rem);
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: var(--space-3) var(--space-4);
    }
    
    .modal-header,
    .modal-body {
        padding: var(--space-4);
    }
    
    .modal-footer {
        padding: 0 var(--space-4) var(--space-4);
        flex-direction: column;
    }
}

/* ==========================
   Open-Market Polish Styles
   (주요 영역: 주문상세/타임라인/로그/툴바)
   ========================== */

/* 공통 표면 카드 */
.surface,
#orderDetailCard,
#orderDetailShipping,
#logsList,
#sellerOrderDetail {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

/* 섹션 제목 */
.section-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin: var(--space-4) 0 var(--space-2);
}

/* 메타 그리드 (라벨/값) */
.meta-grid,
#sellerOrderMeta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    align-items: center;
}

.meta-grid > span:first-child,
#sellerOrderMeta > div:nth-child(odd) {
    color: var(--gray-500);
}

.meta-grid > span:last-child,
#sellerOrderMeta > div:nth-child(even) {
    font-weight: 600;
    color: var(--gray-900);
}

/* 주문 타임라인 */
#orderStatusTimeline.timeline {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-2);
}

#orderStatusTimeline.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    background: var(--gray-200);
    transform: translateY(-50%);
    border-radius: var(--radius-full);
}

#orderStatusTimeline .timeline-step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

#orderStatusTimeline .timeline-step .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
    transition: background-color .25s ease, transform .2s ease, box-shadow .2s ease;
}

#orderStatusTimeline .timeline-step .label {
    font-size: var(--font-size-xs);
    color: var(--gray-600);
    white-space: nowrap;
}

/* 주문 이벤트 로그 */
#orderStatusEvents {
    background: var(--gray-50);
    border: 1px dashed var(--gray-200);
    border-radius: var(--radius-lg);
}

#orderStatusEvents .event-row,
#sellerOrderStatusLogs .log-row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px dashed var(--gray-200);
}

#orderStatusEvents .event-row:last-child,
#sellerOrderStatusLogs .log-row:last-child {
    border-bottom: none;
}

#sellerOrderStatusLogs {
    background: var(--gray-50);
    border: 1px dashed var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
}

/* 로그 탭 툴바 */
#logsTab input,
#logsTab select {
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-300);
    padding: 0 var(--space-3);
    background: var(--white);
}

#logsList {
    overflow: hidden;
}

#logsList .log-item,
#logsList .log-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--gray-100);
}

#logsList .log-item:hover,
#logsList .log-row:hover {
    background: var(--gray-50);
}

/* 상태 배지 */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 9999px;
    transition: background-color .2s ease, color .2s ease, transform .18s ease, box-shadow .18s ease, opacity .18s ease;
    animation: badgePop .18s ease;
}
.badge-status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.status-pending      { background: #fef3c7; color: #92400e; }
.status-paid         { background: #d1fae5; color: #065f46; }
.status-confirmed    { background: #e0e7ff; color: #3730a3; }
.status-preparing    { background: #e0f2fe; color: #075985; }
.status-shipped      { background: #e5e7eb; color: #374151; }
.status-delivered    { background: #dcfce7; color: #166534; }
.status-cancelled    { background: #fee2e2; color: #991b1b; }
.status-partial      { background: #f3e8ff; color: #6b21a8; }
.status-expired      { background: #f5f5f5; color: #525252; }

@keyframes badgePop {
    from { transform: scale(0.96); opacity: .6; }
    to   { transform: scale(1);    opacity: 1; }
}

/* 주문 상세 액션 바 */
#orderDetailActionButtons,
#pendingActionBar {
    display: flex;
    gap: var(--space-2);
}

/* 카트 아이템 카드 개선 */
.cart-item {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: var(--white);
}
