/* === Prestige Sales Dashboard Design Tokens === */
:root {
    --bg-dark: #0B0E14;
    --bg-card: rgba(17, 24, 39, 0.45);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    
    --primary: #3B82F6;
    --primary-glow: rgba(59, 130, 246, 0.15);
    --primary-gradient: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    
    --accent: #8B5CF6;
    --accent-glow: rgba(139, 92, 246, 0.15);
    
    --success: #10B981;
    --danger: #EF4444;
    
    --text-main: #F1F5F9;
    --text-dim: #94A3B8;
    --text-muted: #64748B;
}

/* === Global reset & animations === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Smooth Fade-In --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card, .chart-section, .map-section, .login-card {
    animation: fadeInUp 0.5s ease forwards;
}

/* === Login Page specific styling === */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #06080C;
    position: relative;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.12;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    bottom: -10%;
    right: -10%;
}

.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-card {
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.login-logo i {
    color: var(--primary);
    stroke: var(--primary);
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.login-header p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Forms styling */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
    transition: color 0.3s;
}

.input-wrapper input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 14px 14px 44px;
    color: var(--text-main);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.input-wrapper input:focus + i {
    color: var(--primary);
}

.error-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--danger);
    font-size: 13px;
}

.submit-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 10px;
    padding: 14px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    outline: none;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.submit-btn:active {
    transform: translateY(0);
}

/* === Dashboard Main Layout === */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar styling */
.sidebar {
    width: 280px;
    background: #090B0F;
    border-right: 1px solid var(--border-color);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 40px;
}

.logo i {
    color: var(--primary);
    stroke: var(--primary);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 10px 10px 36px;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: all 0.3s;
}

.search-box input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.nav-btn.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    font-weight: 600;
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 36px;
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-dim);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.action-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-dim);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.action-btn:hover {
    color: var(--text-main);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.avatar {
    background: var(--accent);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.avatar:hover {
    box-shadow: 0 0 12px var(--accent-glow);
    transform: scale(1.05);
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-radius: 16px;
}

.kpi-icon {
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.kpi-icon i {
    width: 24px;
    height: 24px;
}

.kpi-info h3 {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* Section Containers */
.chart-section {
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 16px;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-desc {
    font-size: 12px;
    color: var(--text-dim);
}

.chart-wrapper {
    height: 320px;
    position: relative;
}

.map-section {
    padding: 30px;
    border-radius: 16px;
}

.map-container {
    height: 480px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: #0E121A;
}

/* Custom Naver Map Marker Style */
.custom-map-marker {
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.custom-map-marker:hover {
    transform: scale(1.2);
    z-index: 99999 !important;
}

/* Shiny effect button */
.shiny-effect {
    position: relative;
    overflow: hidden;
}

.shiny-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.1) 40%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.1) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(45deg);
    transition: transform 0.5s ease-out;
    pointer-events: none;
}

.shiny-effect:hover::after {
    transform: translate(50%, 50%) rotate(45deg);
}

/* === Prestige Store Detail Modal === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(3, 5, 8, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    max-height: 800px;
    position: relative;
    padding: 40px;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.close-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-dim);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.close-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-hover);
    transform: rotate(90deg);
}

.modal-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 24px;
}

#modalStoreName {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.modal-kpi-flex {
    display: flex;
    gap: 30px;
}

.m-kpi {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.m-kpi span {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.m-kpi label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 4px;
    text-transform: uppercase;
}

.modal-body {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    min-height: 0; /* Important for inner scrolls to work */
}

.modal-chart-container {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.modal-table-container {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.premium-table th {
    text-align: left;
    color: var(--text-dim);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.premium-table tbody {
    display: block;
    max-height: 480px;
    overflow-y: auto;
    width: 100%;
}

.premium-table thead, .premium-table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.premium-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.product-row {
    cursor: pointer;
    transition: all 0.2s;
}

.product-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.product-row.active-product {
    background: rgba(16, 185, 129, 0.08) !important;
    border-left: 3px solid var(--success);
}

.product-row.active-product td:first-child {
    padding-left: 13px; /* visual alignment offset fix */
}

/* Styling native scrollbars beautifully */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* === Cafe24 Live Sync Status Badges === */
.sync-active-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    padding: 8px 16px;
    color: var(--success);
    font-size: 12.5px;
    font-weight: 600;
}

.sync-alert-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 20px;
    padding: 8px 16px;
    color: #F59E0B;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

.sync-alert-btn:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.green-pulse {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: statusPulse 1.8s infinite;
}

.orange-pulse {
    background-color: #F59E0B;
    box-shadow: 0 0 8px #F59E0B;
    animation: statusPulse 1.8s infinite;
}

/* ==========================================================================
   Premium Mobile responsive CSS Rules & Desktop Smartphone Simulator
   ========================================================================== */

/* 1. Mobile screen styling (Native Media Query) */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        padding: 15px 20px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .sidebar .logo {
        margin-bottom: 0;
        justify-content: space-between;
        width: 100%;
    }
    .sidebar .search-box {
        margin-bottom: 0;
        width: 100%;
    }
    .sidebar .nav-menu {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        border-top: 1px solid var(--border-color);
        padding-top: 12px;
        gap: 8px;
    }
    .sidebar .system-status {
        display: none;
    }
    .main-content {
        padding: 16px;
        width: 100%;
    }
    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 24px;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    .kpi-card {
        padding: 16px;
    }
    .chart-section, .analytics-section, .map-section {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 20px;
    }
    .chart-wrapper {
        height: 220px;
    }
    .map-container {
        height: 280px;
    }
    .premium-table th, .premium-table td {
        padding: 10px 8px;
        font-size: 12.5px;
    }
    /* Modal responsive styles */
    .modal-overlay {
        padding: 10px;
    }
    .modal-content {
        height: 95vh;
        padding: 20px;
        border-radius: 16px;
    }
    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
        padding-bottom: 16px;
    }
    .modal-kpi-flex {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }
    .m-kpi {
        align-items: center;
    }
    .m-kpi span {
        font-size: 16px;
    }
    .modal-body {
        grid-template-columns: 1fr;
        gap: 20px;
        overflow-y: auto;
    }
    .modal-chart-container, .modal-table-container {
        padding: 16px;
        height: 350px;
    }
    .close-btn {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
    }
}

/* 2. Premium Desktop Simulator Frame for testing Mobile Mode */
@media (min-width: 769px) {
    body.mobile-mode-active {
        background-color: #030406;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 30px 20px;
        min-height: 100vh;
    }
    body.mobile-mode-active .dashboard-container {
        width: 430px;
        height: 880px;
        max-height: 95vh;
        border-radius: 36px;
        border: 12px solid #1E293B; /* Simulated phone bezel */
        background-color: var(--bg-dark);
        overflow-y: auto;
        box-shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255,255,255,0.06);
        position: relative;
    }
    
    /* Apply mobile layout style rules inside simulated desktop viewport */
    .mobile-mode-active .dashboard-container {
        flex-direction: column;
    }
    .mobile-mode-active .sidebar {
        width: 100%;
        padding: 15px 20px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    .mobile-mode-active .sidebar .logo {
        margin-bottom: 0;
        justify-content: space-between;
        width: 100%;
    }
    .mobile-mode-active .sidebar .search-box {
        margin-bottom: 0;
        width: 100%;
    }
    .mobile-mode-active .sidebar .nav-menu {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        border-top: 1px solid var(--border-color);
        padding-top: 12px;
        gap: 8px;
    }
    .mobile-mode-active .sidebar .system-status {
        display: none;
    }
    .mobile-mode-active .main-content {
        padding: 16px;
        width: 100%;
    }
    .mobile-mode-active .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 24px;
    }
    .mobile-mode-active .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .mobile-mode-active .kpi-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    .mobile-mode-active .kpi-card {
        padding: 16px;
    }
    .mobile-mode-active .chart-section, 
    .mobile-mode-active .analytics-section, 
    .mobile-mode-active .map-section {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 20px;
    }
    .mobile-mode-active .chart-wrapper {
        height: 220px;
    }
    .mobile-mode-active .map-container {
        height: 280px;
    }
    .mobile-mode-active .premium-table th, 
    .mobile-mode-active .premium-table td {
        padding: 10px 8px;
        font-size: 12.5px;
    }
    
    /* Make the store details modal overlay simulate phone bounds as well */
    .mobile-mode-active .modal-overlay {
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 24px;
        background: rgba(3, 5, 8, 0.92);
        padding: 15px;
    }
    .mobile-mode-active .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        padding: 20px;
        border-radius: 20px;
    }
    .mobile-mode-active .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    .mobile-mode-active .modal-kpi-flex {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    .mobile-mode-active .m-kpi {
        align-items: center;
    }
    .mobile-mode-active .m-kpi span {
        font-size: 15px;
    }
    .mobile-mode-active .modal-body {
        grid-template-columns: 1fr;
        gap: 16px;
        overflow-y: auto;
    }
    .mobile-mode-active .modal-chart-container, 
    .mobile-mode-active .modal-table-container {
        padding: 14px;
        height: auto;
        min-height: 280px;
    }
    .mobile-mode-active .close-btn {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
    }
}
