/* ==========================================================================
   Moments Speciality Coffee - Loyalty Management Dashboard Stylesheet
   Palette: #1E120A, #2A170C, #8B4513, #C6925E, #FDF9F5, #F5E6DA, #2C3E50
   ========================================================================== */

:root {
    --brand-espresso: #2A170C;
    --brand-dark: #1E120A;
    --brand-primary: #8B4513;
    --brand-gold: #C6925E;
    --brand-gold-light: #E0BA8F;
    --brand-sand: #F5E6DA;
    --brand-cream: #FDF9F5;
    --text-dark: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --card-bg: #FFFFFF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f7e6dc;
    color: var(--text-dark);
    min-height: 100vh;
    padding-bottom: 3rem;
}

/* Header */
.loyalty-dash-header {
    background: linear-gradient(135deg, #1E120A 0%, #2A170C 100%);
    color: #ffffff;
    padding: 1.25rem 2rem;
    box-shadow: 0 4px 20px rgba(30, 18, 10, 0.25);
    border-bottom: 2px solid rgba(198, 146, 94, 0.4);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    height: 46px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.brand-titles h1 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #ffffff;
}

.brand-titles p {
    font-size: 0.8rem;
    color: var(--brand-gold-light);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.dash-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dash-btn-primary {
    background: var(--brand-gold);
    color: #ffffff;
}
.dash-btn-primary:hover {
    background: #b5804d;
    transform: translateY(-1px);
}

.dash-btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.dash-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.dash-btn-success {
    background: #2e7d32;
    color: #ffffff;
}
.dash-btn-success:hover {
    background: #1b5e20;
}

.dash-btn-info {
    background: #0288d1;
    color: #ffffff;
}
.dash-btn-info:hover {
    background: #01579b;
}

/* Main Container */
.dash-container {
    max-width: 1400px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
}

/* Nav Tabs */
.dash-tabs-bar {
    display: flex;
    gap: 0.5rem;
    background: #ffffff;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    border: 1px solid rgba(139, 69, 19, 0.1);
}

.dash-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.25rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dash-tab:hover {
    color: var(--brand-primary);
    background: #fdfaf7;
}

.dash-tab.active {
    background: var(--brand-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.25);
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.25s ease-in-out;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.15rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(139, 69, 19, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.kpi-card.c-primary::before { background: var(--brand-primary); }
.kpi-card.c-success::before { background: var(--success); }
.kpi-card.c-gold::before { background: var(--brand-gold); }
.kpi-card.c-warning::before { background: var(--warning); }
.kpi-card.c-info::before { background: var(--info); }
.kpi-card.c-purple::before { background: #8B5CF6; }

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kpi-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.kpi-icon {
    font-size: 1.1rem;
    opacity: 0.7;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-dark);
    margin: 0.4rem 0 0.2rem;
    letter-spacing: -0.5px;
}

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

/* Table Cards */
.dash-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(139, 69, 19, 0.08);
    margin-bottom: 1.5rem;
}

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

.dash-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-espresso);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search Bar */
.search-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #f9fafb;
    border: 1.5px solid var(--border-color);
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 380px;
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: var(--brand-gold);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(198, 146, 94, 0.15);
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* Data Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.dash-table th {
    background: #f9fafb;
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--brand-espresso);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.dash-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.dash-table tr:hover td {
    background: #fdfaf7;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-active { background: #d1fae5; color: #065f46; }
.badge-stamp { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; font-family: monospace; font-size: 0.85rem; }
.badge-reward { background: #dbeafe; color: #1e40af; }
.badge-redeemed { background: #fee2e2; color: #991b1b; }

/* Progress Mini-Bar */
.stamp-minibar {
    display: flex;
    gap: 3px;
    align-items: center;
}

.stamp-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e5e7eb;
}

.stamp-dot.filled {
    background: var(--brand-gold);
    box-shadow: 0 0 4px rgba(198, 146, 94, 0.5);
}

/* Forms in Settings & Redemption */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-espresso);
    margin-bottom: 0.4rem;
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
    background: #ffffff;
}

.form-control:focus {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px rgba(198, 146, 94, 0.15);
}

textarea.form-control {
    resize: vertical;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 8, 4, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-sheet {
    background: #ffffff;
    width: 100%;
    max-width: 540px;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    color: #4b5563;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notification Toast */
.dash-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1e120a;
    color: #ffffff;
    padding: 0.85rem 1.4rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--brand-gold);
    font-size: 0.88rem;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.dash-toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .dash-tabs-bar {
        padding: 0.3rem;
    }
    .dash-tab {
        padding: 0.55rem 0.9rem;
        font-size: 0.82rem;
    }
}
