/* ===== ORDERS DASHBOARD CSS ===== */
:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --bg: #0a0e1a;
    --bg-card: #111827;
    --bg-hover: #1a2234;
    --bg-input: #0d1424;
    --border: #1e293b;
    --border-focus: #6366f1;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --green: #10b981;
    --green-bg: rgba(16, 185, 129, 0.12);
    --yellow: #f59e0b;
    --yellow-bg: rgba(245, 158, 11, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.12);
    --purple: #a855f7;
    --purple-bg: rgba(168, 85, 247, 0.12);
    --cyan: #06b6d4;
    --cyan-bg: rgba(6, 182, 212, 0.12);
    --orange: #f97316;
    --orange-bg: rgba(249, 115, 22, 0.12);
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===== TOP NAV ===== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo { font-size: 1.4rem; }

.nav-title {
    font-size: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-light), var(--cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active { color: var(--accent-light); background: var(--accent-glow); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.user-role {
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.role-admin { background: var(--purple-bg); color: var(--purple); }
.role-staff { background: var(--blue-bg); color: var(--blue); }
.role-viewer { background: var(--cyan-bg); color: var(--cyan); }
.role-customer { background: var(--green-bg); color: var(--green); }

.btn-login, .btn-logout {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-login:hover, .btn-logout:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 56px);
}

.login-card {
    text-align: center;
    padding: 3rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    max-width: 380px;
    width: 100%;
}

.login-icon { font-size: 3rem; margin-bottom: 1rem; }
.login-card h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.login-card p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.5rem; }

.btn-google {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 2rem;
    background: #fff;
    color: #333;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-google:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

/* ===== DASHBOARD ===== */
.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
}

.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dash-header h2 { font-size: 1.2rem; font-weight: 700; }

.dash-stats {
    display: flex;
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.stat-num { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.stat-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.stat-pending { border: 1px solid rgba(245,158,11,0.3); background: rgba(245,158,11,0.05); }
.stat-pending .stat-num, .stat-pending .stat-label { color: var(--yellow); }

.stat-shipped { border: 1px solid rgba(56,189,248,0.3); background: rgba(56,189,248,0.05); }
.stat-shipped .stat-num, .stat-shipped .stat-label { color: var(--blue); }

.stat-done { border: 1px solid rgba(16,185,129,0.3); background: rgba(16,185,129,0.05); }
.stat-done .stat-num, .stat-done .stat-label { color: var(--green); }

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.toolbar-right {
    display: flex;
    gap: 0.5rem;
}

.search-input {
    flex: 1;
    max-width: 400px;
    padding: 0.55rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select {
    padding: 0.55rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
    appearance: auto;
    transition: all var(--transition);
}

.filter-select:focus { border-color: var(--accent); }

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-action:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--accent);
}

.btn-add { border-color: var(--green); color: var(--green); }
.btn-add:hover { background: var(--green-bg); }
.btn-import { border-color: var(--blue); color: var(--blue); }
.btn-import:hover { background: var(--blue-bg); }

/* ===== ORDER TABLE ===== */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
}

.order-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.order-table thead th {
    padding: 0.75rem 0.6rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--bg-card);
    position: sticky;
    top: 0;
}

.order-table tbody td {
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid rgba(30, 41, 59, 0.5);
    vertical-align: middle;
}

.order-table tbody tr:hover {
    background: var(--bg-hover);
}

.col-check { width: 36px; text-align: center; }
.col-check input { cursor: pointer; accent-color: var(--accent); }

.col-finance { text-align: right; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-주문접수 { background: var(--blue-bg); color: var(--blue); }
.status-현지주문완료 { background: var(--purple-bg); color: var(--purple); }
.status-입고완료 { background: var(--cyan-bg); color: var(--cyan); }
.status-출고 { background: var(--yellow-bg); color: var(--yellow); }
.status-배송중 { background: var(--orange-bg); color: var(--orange); }
.status-통관중 { background: var(--red-bg); color: var(--red); }
.status-배송완료 { background: var(--green-bg); color: var(--green); }

/* Tracking link */
.tracking-link {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.78rem;
}

.tracking-link:hover { text-decoration: underline; }

/* Action buttons in table */
.row-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-row {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-row:hover { color: var(--text); background: var(--bg-hover); }
.btn-row.btn-detail:hover { color: var(--accent-light); border-color: var(--accent); }
.btn-row.btn-edit:hover { color: var(--yellow); border-color: var(--yellow); }
.btn-row.btn-delete:hover { color: var(--red); border-color: var(--red); }

/* Empty state */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; }
.empty-hint { font-size: 0.8rem !important; margin-top: 0.5rem; }

/* ===== CUSTOMER VIEW ===== */
.customer-view {
    max-width: 800px;
    margin: 0 auto;
}

.customer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.customer-icon { font-size: 2rem; }

.customer-order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: all var(--transition);
}

.customer-order-card:hover { border-color: var(--accent); }

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.order-card-num {
    font-weight: 700;
    color: var(--accent-light);
}

.order-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.order-card-body .label { color: var(--text-muted); font-size: 0.75rem; }

/* Status progress bar */
.status-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    min-width: 70px;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    margin: 0 auto 0.3rem;
    transition: all var(--transition);
}

.progress-step.active .progress-dot,
.progress-step.done .progress-dot {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.progress-step.done .progress-dot { background: var(--green); }

.progress-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 600;
}

.progress-step.active .progress-label { color: var(--accent-light); }
.progress-step.done .progress-label { color: var(--green); }

.progress-line {
    flex: 1;
    height: 2px;
    background: var(--border);
    min-width: 10px;
    margin-bottom: 1.2rem;
}

.progress-line.done { background: var(--green); }

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.25s ease;
}

.modal-lg { max-width: 700px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text); }

.modal-body { padding: 1.25rem; }

/* ===== FORMS ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.55rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.btn-submit {
    padding: 0.55rem 1.5rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-submit:hover { background: var(--accent-light); }

.btn-cancel {
    padding: 0.55rem 1.5rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-cancel:hover { color: var(--text); background: var(--bg-hover); }

/* ===== SETTINGS MODAL ===== */
.settings-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.settings-tab {
    padding: 0.45rem 1rem;
    background: transparent;
    color: var(--text-muted);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}

.settings-tab:hover { color: var(--text); }
.settings-tab.active { color: var(--accent-light); background: var(--accent-glow); }

.settings-panel { display: none; }
.settings-panel.active { display: block; }

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.user-table th, .user-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.user-table th {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.user-table select {
    padding: 0.3rem 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.8rem;
    font-family: var(--font);
}

/* Store management */
.store-add-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.store-add-row input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
}

.store-list {
    list-style: none;
}

.store-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

/* ===== IMPORT ===== */
.drop-zone-mini {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin: 1rem 0;
}

.drop-zone-mini:hover { border-color: var(--accent); background: var(--accent-glow); }
.drop-zone-mini p { color: var(--text-muted); font-size: 0.9rem; }

.paste-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.85rem;
    font-family: var(--font);
    resize: none;
    outline: none;
    transition: all var(--transition);
}

.paste-area:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.import-count { margin: 1rem 0; font-size: 0.9rem; color: var(--text-secondary); }

/* ===== COMMENTS ===== */
.comments-section { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.comment-item { padding: 0.75rem; border-bottom: 1px solid rgba(30,41,59,0.3); }
.comment-author { font-weight: 700; font-size: 0.8rem; color: var(--accent-light); }
.comment-time { font-size: 0.7rem; color: var(--text-muted); margin-left: 0.5rem; }
.comment-text { font-size: 0.85rem; margin-top: 0.3rem; color: var(--text-secondary); }

.comment-input-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.comment-input-row input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.82rem;
    font-family: var(--font);
    outline: none;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.75rem 1.5rem;
    background: var(--green);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.85rem;
    z-index: 500;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .dashboard { padding: 1rem; }
    .dash-header { flex-direction: column; align-items: flex-start; }
    .toolbar { flex-direction: column; }
    .toolbar-left { flex-direction: column; }
    .form-grid { grid-template-columns: 1fr; }
    .nav-title { display: none; }
    .order-card-body { grid-template-columns: 1fr; }
}

/* Delivery Tracker Timeline Styles */
.tracker-timeline {
    position: relative;
    padding: 1.5rem 1rem;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(17, 24, 39, 0.4);
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 1rem;
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid var(--border);
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -7px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--bg);
}

.timeline-item.latest .timeline-dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.timeline-item.latest {
    border-left-color: var(--green);
}

.timeline-content {
    background: rgba(30, 41, 59, 0.5);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.timeline-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.timeline-location {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.timeline-status {
    font-size: 0.85rem;
    color: var(--accent-light);
    margin-bottom: 0.25rem;
}

.timeline-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-badge-lg {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--green);
    color: white;
    margin-bottom: 0.5rem;
}

.carrier-info {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.tracking-error {
    padding: 2rem;
    text-align: center;
    color: var(--red);
    font-size: 0.9rem;
}

