/* assets/css/merchantdashboard.css */

/* ============================================
   1. DASHBOARD SHELL
   ============================================ */
.merch-dash {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ============================================
   2. HERO BAR
   ============================================ */
.merch-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    background: linear-gradient(135deg, var(--sg-black) 0%, #2a2a2a 100%);
    border-radius: var(--sg-radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
    flex-wrap: wrap;
}

.merch-hero::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: var(--sg-orange);
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.2;
    top: -100px;
    right: -100px;
    pointer-events: none;
}

.merch-hero-identity {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    position: relative;
    z-index: 2;
}

.merch-hero-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--sg-orange);
    color: var(--sg-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sg-font-display);
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow: 0 6px 20px rgba(247, 148, 30, 0.35);
}

.merch-hero-eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sg-orange);
    margin-bottom: 0.25rem;
}

.merch-hero-name {
    font-family: var(--sg-font-display);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--sg-white);
    margin: 0;
    letter-spacing: -0.01em;
}

.merch-hero-code {
    font-family: var(--sg-font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.55);
}

/* Live Activity Indicator */
.merch-hero-live {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.85rem 1.25rem;
    border-radius: var(--sg-radius-pill);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
    max-width: 420px;
}

.merch-live-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.merch-live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2e7d46;
    box-shadow: 0 0 0 0 rgba(46, 125, 70, 0.7);
    animation: merchLivePulse 2s infinite;
}

.merch-live-dot.active {
    background: var(--sg-orange);
    box-shadow: 0 0 0 0 rgba(247, 148, 30, 0.7);
}

@keyframes merchLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(46, 125, 70, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(46, 125, 70, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 125, 70, 0); }
}

.merch-live-label {
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
}

.merch-live-content {
    font-size: 0.85rem;
    color: var(--sg-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.merch-live-placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
}

/* ============================================
   3. KPI CARDS
   ============================================ */
.merch-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.merch-kpi-card {
    background: var(--sg-surface);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.25s ease;
}

.merch-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--sg-shadow-md);
    border-color: var(--sg-orange);
}

.merch-kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--sg-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.merch-kpi-icon--redemptions { background: var(--sg-orange-tint); color: var(--sg-orange-dark); }
.merch-kpi-icon--today { background: #e8f4fd; color: #2980b9; }
.merch-kpi-icon--coupons { background: #e5f3e8; color: var(--sg-success); }
.merch-kpi-icon--branches { background: #f3e8fd; color: #8e44ad; }

.merch-kpi-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.merch-kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--sg-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.merch-kpi-value {
    font-family: var(--sg-font-display);
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--sg-black);
    line-height: 1.1;
    margin: 0.25rem 0;
}

.merch-kpi-trend {
    font-size: 0.78rem;
    font-weight: 600;
}

.merch-kpi-trend.up { color: var(--sg-success); }
.merch-kpi-trend.down { color: var(--sg-danger); }

/* ============================================
   4. TABS
   ============================================ */
.merch-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 2px solid var(--sg-border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.merch-tabs::-webkit-scrollbar { display: none; }

.merch-tab {
    background: transparent;
    border: none;
    padding: 0.85rem 1.25rem;
    font-family: var(--sg-font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--sg-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.merch-tab:hover {
    color: var(--sg-black);
}

.merch-tab.active {
    color: var(--sg-black);
    border-bottom-color: var(--sg-orange);
}

.merch-tab i {
    font-size: 1rem;
}

/* ============================================
   5. PANELS
   ============================================ */
.merch-panel {
    display: none;
    animation: merchFadeIn 0.35s ease;
}

.merch-panel.active {
    display: block;
}

@keyframes merchFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.merch-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.merch-panel-title {
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--sg-black);
    margin: 0;
}

.merch-panel-subtitle {
    color: var(--sg-text-muted);
    font-size: 0.9rem;
    margin: 0.25rem 0 0;
}

.merch-panel-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   6. BUTTONS
   ============================================ */
.merch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--sg-radius-pill);
    font-family: var(--sg-font-display);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    text-decoration: none;
}

.merch-btn--primary {
    background: var(--sg-orange);
    color: var(--sg-black);
    border-color: var(--sg-orange);
}

.merch-btn--primary:hover {
    background: var(--sg-orange-dark);
    border-color: var(--sg-orange-dark);
    color: var(--sg-white);
    transform: translateY(-1px);
}

.merch-btn--ghost {
    background: transparent;
    color: var(--sg-gray-700);
    border-color: var(--sg-border);
}

.merch-btn--ghost:hover {
    border-color: var(--sg-black);
    background: var(--sg-black);
    color: var(--sg-orange);
}

/* ============================================
   7. FILTERS
   ============================================ */
.merch-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.merch-filter-search {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 320px;
}

.merch-filter-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--sg-gray-400);
    pointer-events: none;
}

.merch-filter-search input {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.4rem;
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-pill);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease;
    background: var(--sg-surface);
}

.merch-filter-search:focus-within i {
    color: var(--sg-orange);
}

.merch-filter-search input:focus {
    border-color: var(--sg-orange);
    box-shadow: 0 0 0 3px var(--sg-orange-tint-strong);
}

.merch-filter-select,
.merch-filter-date,
.merch-page-size {
    padding: 0.6rem 1rem;
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-pill);
    font-size: 0.875rem;
    outline: none;
    background: var(--sg-surface);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.merch-filter-select:focus,
.merch-filter-date:focus,
.merch-page-size:focus {
    border-color: var(--sg-orange);
    box-shadow: 0 0 0 3px var(--sg-orange-tint-strong);
}

/* View Toggle (Active/Deactive/All) */
.merch-view-toggle {
    display: inline-flex;
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-pill);
    overflow: hidden;
    background: var(--sg-surface);
}

.merch-view-btn {
    background: transparent;
    border: none;
    padding: 0.5rem 1.1rem;
    font-family: var(--sg-font-display);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--sg-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.merch-view-btn.active {
    background: var(--sg-black);
    color: var(--sg-orange);
}

.merch-view-btn:hover:not(.active) {
    color: var(--sg-black);
}

/* ============================================
   8. RESULTS INFO
   ============================================ */
.merch-results-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--sg-text-muted);
    flex-wrap: wrap;
}

.merch-results-info strong {
    color: var(--sg-orange-dark);
}

/* ============================================
   9. DATA TABLES
   ============================================ */
.merch-table-wrap {
    background: var(--sg-surface);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-md);
    overflow: hidden;
    position: relative;
    min-height: 240px;
}

.merch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.merch-table thead {
    background: var(--sg-off);
    border-bottom: 2px solid var(--sg-border);
}

.merch-table th {
    padding: 0.85rem 1rem;
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sg-gray-700);
    text-align: left;
    white-space: nowrap;
}

.merch-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--sg-gray-100);
    color: var(--sg-black);
    vertical-align: middle;
}

.merch-table tbody tr {
    transition: background 0.15s ease;
}

.merch-table tbody tr:hover {
    background: var(--sg-orange-tint);
}

.merch-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   10. LOADING & EMPTY STATES
   ============================================ */
.merch-loading,
.merch-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--sg-surface);
    color: var(--sg-text-muted);
    gap: 0.75rem;
    padding: 2rem;
    z-index: 5;
}

.merch-loading p,
.merch-empty p {
    margin: 0;
    font-size: 0.9rem;
}

.merch-empty i {
    font-size: 3rem;
    color: var(--sg-gray-300);
}

/* ============================================
   11. PAGINATION
   ============================================ */
.merch-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    list-style: none;
    padding: 0;
    flex-wrap: wrap;
}

.merch-page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-sm);
    background: var(--sg-surface);
    color: var(--sg-gray-800);
    font-family: var(--sg-font-display);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.merch-page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--sg-orange);
    color: var(--sg-orange-dark);
    background: var(--sg-orange-tint);
}

.merch-page-btn.active {
    background: var(--sg-orange);
    border-color: var(--sg-orange);
    color: var(--sg-black);
    font-weight: 700;
}

.merch-page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ============================================
   12. LIVE FEED
   ============================================ */
.merch-live-feed {
    background: var(--sg-surface);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-md);
    padding: 1rem;
    min-height: 320px;
    max-height: 520px;
    overflow-y: auto;
    position: relative;
}

.merch-live-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--sg-radius-md);
    border: 1px solid var(--sg-gray-100);
    margin-bottom: 0.75rem;
    background: var(--sg-off);
    animation: merchSlideIn 0.4s ease;
}

@keyframes merchSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.merch-live-item-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sg-orange-tint);
    color: var(--sg-orange-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.merch-live-item-body {
    flex: 1;
    min-width: 0;
}

.merch-live-item-title {
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--sg-black);
    margin: 0 0 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.merch-live-item-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--sg-text-muted);
}

.merch-live-item-meta i {
    color: var(--sg-orange);
    margin-right: 0.25rem;
}

.merch-live-item-time {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--sg-success);
    white-space: nowrap;
}

.merch-live-empty {
    text-align: center;
    color: var(--sg-text-muted);
    padding: 3rem 1rem;
}

.merch-live-empty i {
    font-size: 3rem;
    color: var(--sg-gray-300);
    display: block;
    margin-bottom: 1rem;
}

.merch-live-empty p { margin: 0; }

/* ============================================
   13. BRANCH CARDS
   ============================================ */
.merch-branch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.merch-branch-card {
    background: var(--sg-surface);
    border: 1.5px solid var(--sg-border);
    border-radius: var(--sg-radius-md);
    padding: 1.25rem;
    transition: all 0.25s ease;
}

.merch-branch-card:hover {
    border-color: var(--sg-orange);
    transform: translateY(-3px);
    box-shadow: var(--sg-shadow-md);
}

.merch-branch-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--sg-border);
}

.merch-branch-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--sg-radius-md);
    background: var(--sg-orange-tint);
    color: var(--sg-orange-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.merch-branch-title {
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--sg-black);
    margin: 0;
}

.merch-branch-code {
    font-size: 0.78rem;
    color: var(--sg-text-muted);
    font-family: var(--sg-font-display);
    font-weight: 600;
}

.merch-branch-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--sg-text-muted);
}

.merch-branch-detail-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.merch-branch-detail-row i {
    color: var(--sg-orange);
    width: 16px;
}

.merch-branch-staff {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--sg-border);
}

.merch-branch-staff-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sg-text-muted);
    margin-bottom: 0.5rem;
}

.merch-staff-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--sg-off);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-pill);
    font-size: 0.8rem;
    margin: 0.25rem 0.25rem 0 0;
}

.merch-staff-chip i {
    color: var(--sg-orange);
}

/* ============================================
   14. CHARTS
   ============================================ */
.merch-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.merch-chart-card {
    background: var(--sg-surface);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-md);
    padding: 1.25rem;
}

.merch-chart-title {
    font-family: var(--sg-font-display);
    font-weight: 700;
    font-size: 1rem;
    margin: 0 0 1rem;
    color: var(--sg-black);
}

.merch-chart-body {
    position: relative;
    height: 280px;
}

/* ============================================
   15. PROFILE CARD
   ============================================ */
.merch-profile-card {
    background: var(--sg-surface);
    border: 1px solid var(--sg-border);
    border-radius: var(--sg-radius-lg);
    padding: 1.75rem;
}

.merch-profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--sg-border);
    margin-bottom: 1.5rem;
}

.merch-profile-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--sg-orange);
    color: var(--sg-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--sg-font-display);
    font-weight: 800;
    font-size: 2rem;
    box-shadow: 0 8px 24px rgba(247, 148, 30, 0.3);
}

.merch-profile-info h3 {
    font-family: var(--sg-font-display);
    font-weight: 800;
    font-size: 1.5rem;
    margin: 0 0 0.25rem;
}

.merch-profile-code {
    color: var(--sg-text-muted);
    font-family: var(--sg-font-display);
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.merch-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 2rem;
}

.merch-profile-field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sg-text-muted);
    margin-bottom: 0.25rem;
}

.merch-profile-field span {
    font-size: 0.95rem;
    color: var(--sg-black);
    font-weight: 500;
}

/* ============================================
   16. BADGES
   ============================================ */
.merch-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--sg-radius-pill);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.merch-status-badge--active {
    background: #e5f3e8;
    color: var(--sg-success);
}

.merch-status-badge--deactive {
    background: #fbeae7;
    color: var(--sg-danger);
}

.merch-status-badge--pending {
    background: var(--sg-orange-tint);
    color: var(--sg-orange-dark);
}

/* ============================================
   17. RESPONSIVE
   ============================================ */
@media (max-width: 1199px) {
    .merch-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .merch-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    .merch-dash { padding: 1rem; }
    .merch-hero { padding: 1.25rem; flex-direction: column; align-items: flex-start; }
    .merch-hero-live { max-width: 100%; width: 100%; }
    .merch-kpi-grid { grid-template-columns: 1fr; }
    .merch-profile-grid { grid-template-columns: 1fr; }
    .merch-tabs { gap: 0; }
    .merch-tab { padding: 0.75rem 1rem; font-size: 0.85rem; }
    .merch-filters { flex-direction: column; align-items: stretch; }
    .merch-filter-search { max-width: 100%; }
    .merch-table-wrap { overflow-x: auto; }
    .merch-table { min-width: 800px; }
}