/* WeDealize Design System V2 - Naver Shopping Style
 * Complete redesign based on reference screenshots
 */

/* ==================== CSS Reset for V2 ==================== */
body.v2-theme * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.v2-theme {
    font-family: -apple-system, BlinkMacSystemFont, 'Malgun Gothic', '맑은 고딕', 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    color: #333;
    background: #f5f5f5;
    line-height: 1.5;
}

/* ==================== Portal Layout ==================== */
body.v2-theme .portal-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==================== Header ==================== */
body.v2-theme .portal-header {
    height: 54px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

body.v2-theme .header-content {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}

body.v2-theme .logo {
    width: 200px;
    height: 54px;
    background: #03c75a;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
}

body.v2-theme .logo img {
    height: 24px;
    filter: brightness(0) invert(1);
}

body.v2-theme .logo::after {
    content: 'shopping';
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

body.v2-theme .portal-badge {
    display: none;
}

body.v2-theme .header-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 100%;
    border-bottom: none;
}

body.v2-theme .header-nav .language-dropdown {
    order: 1;
}

body.v2-theme .header-nav .user-menu {
    order: 2;
    display: flex !important;
    align-items: center;
    gap: 12px;
}

body.v2-theme .btn-logout {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
}

body.v2-theme .btn-logout:hover {
    background: #f5f5f5;
}

/* ==================== Main Layout ==================== */
body.v2-theme .portal-main {
    display: flex;
    margin-top: 54px;
    min-height: calc(100vh - 54px);
}

/* ==================== Sidebar ==================== */
body.v2-theme .wd-sidebar {
    width: 200px;
    background: #0074e9;
    position: fixed;
    top: 54px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
}

body.v2-theme .wd-sidebar::-webkit-scrollbar {
    width: 6px;
}

body.v2-theme .wd-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

body.v2-theme .wd-sidebar-header {
    display: none;
}

body.v2-theme .wd-workspace-switcher {
    display: none !important;
}

body.v2-theme .wd-sidebar-nav {
    padding: 8px 0;
}

/* Nav Items */
body.v2-theme .wd-nav-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: transparent;
    gap: 10px;
}

body.v2-theme .wd-nav-item:hover {
    background: rgba(255,255,255,0.1);
}

body.v2-theme .wd-nav-item.active {
    background: rgba(255,255,255,0.15);
    font-weight: 500;
}

body.v2-theme .wd-nav-item .wd-nav-icon {
    width: 18px;
    height: 18px;
    stroke: rgba(255,255,255,0.9);
    flex-shrink: 0;
}

body.v2-theme .wd-nav-item.active .wd-nav-icon {
    stroke: #fff;
}

/* Nav Groups */
body.v2-theme .wd-nav-group {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

body.v2-theme .wd-nav-parent {
    position: relative;
}

body.v2-theme .wd-nav-arrow {
    width: 12px;
    height: 12px;
    stroke: rgba(255,255,255,0.6);
    margin-left: auto;
    transition: transform 0.2s;
}

body.v2-theme .wd-nav-group.expanded .wd-nav-arrow {
    transform: rotate(180deg);
}

body.v2-theme .wd-nav-submenu {
    background: rgba(0,0,0,0.15);
    display: none;
}

body.v2-theme .wd-nav-group.expanded .wd-nav-submenu {
    display: block;
}

body.v2-theme .wd-nav-child {
    padding: 10px 16px 10px 44px;
    font-size: 12px;
    color: rgba(255,255,255,0.8);
}

body.v2-theme .wd-nav-child::before {
    display: none;
}

body.v2-theme .wd-nav-child.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Sidebar Footer */
body.v2-theme .wd-sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: rgba(0,0,0,0.1);
    border-top: 1px solid rgba(255,255,255,0.1);
}

body.v2-theme .wd-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

body.v2-theme .wd-user-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.v2-theme .wd-user-avatar svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
}

body.v2-theme .wd-user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
}

body.v2-theme .wd-user-email {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
}

/* ==================== Content Area ==================== */
body.v2-theme .portal-content,
body.v2-theme .dashboard-content,
body.v2-theme #dashboard-section {
    margin-left: 200px;
    padding: 24px;
    background: #f5f5f5;
    min-height: calc(100vh - 54px);
    width: calc(100% - 200px);
}

/* ==================== Page Header ==================== */
body.v2-theme .section-header,
body.v2-theme .wd-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

body.v2-theme .section-title,
body.v2-theme .wd-section-title {
    font-size: 22px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

body.v2-theme .section-actions {
    display: flex;
    gap: 8px;
}

/* ==================== Status Cards ==================== */
body.v2-theme .v2-status-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

body.v2-theme .v2-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 16px 24px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

body.v2-theme .v2-stat-card:hover {
    border-color: #0074e9;
}

body.v2-theme .v2-stat-card.active {
    border-color: #0074e9;
    background: #f0f7ff;
}

body.v2-theme .v2-stat-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

body.v2-theme .v2-stat-value {
    font-size: 20px;
    font-weight: 700;
}

body.v2-theme .v2-stat-card[data-type="total"] .v2-stat-value { color: #0074e9; }
body.v2-theme .v2-stat-card[data-type="active"] .v2-stat-value { color: #03c75a; }
body.v2-theme .v2-stat-card[data-type="soldout"] .v2-stat-value { color: #ff3d3d; }
body.v2-theme .v2-stat-card[data-type="inactive"] .v2-stat-value { color: #999; }

/* ==================== Filter/Search Bar ==================== */
body.v2-theme .v2-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 16px;
}

body.v2-theme .v2-filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    background: #fff;
    min-width: 120px;
}

body.v2-theme .v2-filter-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

body.v2-theme .v2-filter-input:focus {
    outline: none;
    border-color: #0074e9;
}

body.v2-theme .v2-filter-btn {
    padding: 8px 16px;
    background: #0074e9;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

body.v2-theme .v2-filter-btn:hover {
    background: #0066d6;
}

/* ==================== Tabs ==================== */
body.v2-theme .v2-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e5e5e5;
    background: #fff;
    margin-bottom: 0;
}

body.v2-theme .v2-tab {
    padding: 14px 20px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    white-space: nowrap;
}

body.v2-theme .v2-tab:hover {
    color: #333;
}

body.v2-theme .v2-tab.active {
    color: #0074e9;
    border-bottom-color: #0074e9;
    font-weight: 500;
}

body.v2-theme .v2-tab .v2-tab-count {
    display: inline-block;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    padding: 0 6px;
    margin-left: 6px;
    background: #ff3d3d;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    text-align: center;
}

/* ==================== Data Table ==================== */
body.v2-theme .v2-table-wrap {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}

body.v2-theme .v2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

body.v2-theme .v2-table thead {
    background: #fafafa;
}

body.v2-theme .v2-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    color: #333;
    border-bottom: 1px solid #e5e5e5;
    white-space: nowrap;
}

body.v2-theme .v2-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    vertical-align: middle;
}

body.v2-theme .v2-table tbody tr:hover {
    background: #fafafa;
}

body.v2-theme .v2-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Checkbox */
body.v2-theme .v2-table th:first-child,
body.v2-theme .v2-table td:first-child {
    width: 48px;
    text-align: center;
}

body.v2-theme .v2-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #0074e9;
}

/* Product Cell */
body.v2-theme .v2-product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

body.v2-theme .v2-product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid #e5e5e5;
    flex-shrink: 0;
}

body.v2-theme .v2-product-name {
    font-size: 13px;
    color: #333;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.v2-theme .v2-product-name:hover {
    color: #0074e9;
    text-decoration: underline;
    cursor: pointer;
}

/* ==================== Badges ==================== */
body.v2-theme .v2-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
}

body.v2-theme .v2-badge-blue {
    background: #e8f4fd;
    color: #0074e9;
}

body.v2-theme .v2-badge-green {
    background: #e8f9ed;
    color: #03c75a;
}

body.v2-theme .v2-badge-red {
    background: #ffebeb;
    color: #ff3d3d;
}

body.v2-theme .v2-badge-orange {
    background: #fff4e6;
    color: #ff9500;
}

body.v2-theme .v2-badge-gray {
    background: #f5f5f5;
    color: #999;
}

/* ==================== Buttons ==================== */
body.v2-theme .v2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    white-space: nowrap;
}

body.v2-theme .v2-btn-primary {
    background: #0074e9;
    color: #fff;
    border-color: #0074e9;
}

body.v2-theme .v2-btn-primary:hover {
    background: #0066d6;
}

body.v2-theme .v2-btn-secondary {
    background: #fff;
    color: #333;
    border-color: #ddd;
}

body.v2-theme .v2-btn-secondary:hover {
    background: #f5f5f5;
}

body.v2-theme .v2-btn-success {
    background: #03c75a;
    color: #fff;
    border-color: #03c75a;
}

body.v2-theme .v2-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ==================== Pagination ==================== */
body.v2-theme .v2-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    background: #fff;
    border-top: 1px solid #e5e5e5;
}

body.v2-theme .v2-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

body.v2-theme .v2-page-btn:hover {
    border-color: #0074e9;
    color: #0074e9;
}

body.v2-theme .v2-page-btn.active {
    background: #0074e9;
    border-color: #0074e9;
    color: #fff;
}

body.v2-theme .v2-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Date Range Picker ==================== */
body.v2-theme .v2-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.v2-theme .v2-date-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    width: 130px;
}

body.v2-theme .v2-date-sep {
    color: #999;
}

/* ==================== Cards ==================== */
body.v2-theme .v2-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
}

body.v2-theme .v2-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

body.v2-theme .v2-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* ==================== Empty State ==================== */
body.v2-theme .v2-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
}

body.v2-theme .v2-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

body.v2-theme .v2-empty-text {
    font-size: 14px;
}

/* ==================== Auth Section Override ==================== */
body.v2-theme .wd-auth-section {
    margin-left: 0;
    width: 100%;
}

body.v2-theme .wd-auth-card {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 40px;
}

body.v2-theme .wd-btn-primary {
    background: #0074e9;
    border-color: #0074e9;
}

body.v2-theme .wd-btn-primary:hover {
    background: #0066d6;
}

/* ==================== Forms ==================== */
body.v2-theme .wd-input,
body.v2-theme .wd-form-input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
    transition: border-color 0.15s;
}

body.v2-theme .wd-input:focus,
body.v2-theme .wd-form-input:focus {
    outline: none;
    border-color: #0074e9;
}

body.v2-theme .wd-form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

/* ==================== Scrollbar ==================== */
body.v2-theme ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.v2-theme ::-webkit-scrollbar-track {
    background: #f5f5f5;
}

body.v2-theme ::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

body.v2-theme ::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==================== Dashboard Sections Override ==================== */
body.v2-theme .dashboard-grid,
body.v2-theme .wd-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

body.v2-theme .dashboard-card,
body.v2-theme .wd-dashboard-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
}

body.v2-theme .dashboard-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
}

/* ==================== Table Overrides ==================== */
body.v2-theme .wd-table,
body.v2-theme .data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

body.v2-theme .wd-table thead,
body.v2-theme .data-table thead {
    background: #fafafa;
}

body.v2-theme .wd-table th,
body.v2-theme .data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 500;
    color: #333;
    border-bottom: 1px solid #e5e5e5;
}

body.v2-theme .wd-table td,
body.v2-theme .data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}

body.v2-theme .wd-table tbody tr:hover,
body.v2-theme .data-table tbody tr:hover {
    background: #fafafa;
}

/* ==================== Existing Component Overrides ==================== */
body.v2-theme .wd-btn {
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

body.v2-theme .wd-badge,
body.v2-theme .badge {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
}

body.v2-theme .wd-status-badge {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
}

/* Status badge colors */
body.v2-theme .wd-status-badge.status-active,
body.v2-theme .badge-green {
    background: #e8f9ed;
    color: #03c75a;
}

body.v2-theme .wd-status-badge.status-pending,
body.v2-theme .badge-orange {
    background: #fff4e6;
    color: #ff9500;
}

body.v2-theme .wd-status-badge.status-inactive,
body.v2-theme .badge-gray {
    background: #f5f5f5;
    color: #999;
}

/* ==================== Section Visibility ==================== */
body.v2-theme #dashboard-section[style*="display: block"] ~ .wd-sidebar,
body.v2-theme #dashboard-section:not([style*="display: none"]) ~ .wd-sidebar {
    display: block;
}

body.v2-theme #auth-section[style*="display: block"] ~ .wd-sidebar {
    display: none;
}
