/* ============================================
   Business Dashboard Template - Custom Styles
   Description: Modern SaaS dashboard theme
   ============================================ */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --dashboard-primary: #1e40af;
    --dashboard-primary-light: #3b82f6;
    --dashboard-accent: #059669;
    --dashboard-accent-light: #10b981;
    --dashboard-warning: #d97706;
    --dashboard-danger: #dc2626;
    --dashboard-purple: #7c3aed;

    --dashboard-bg: #f1f5f9;
    --dashboard-card-bg: #ffffff;
    --dashboard-text: #1e293b;
    --dashboard-text-muted: #64748b;
    --dashboard-border: #e2e8f0;

    --dashboard-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --dashboard-radius: 12px;
    --dashboard-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --dashboard-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Accessibility Widget Theme - Override purple to dashboard blue */
    --rsl-a11y-primary: #1e40af;
    --rsl-a11y-primary-dark: #1e3a8a;
    --rsl-a11y-primary-light: #3b82f6;
    --rsl-a11y-secondary: #3b82f6;
    --rsl-a11y-button-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --rsl-a11y-button-shadow: 0 4px 16px rgba(30, 64, 175, 0.4);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --dashboard-bg: #0f172a;
    --dashboard-card-bg: #1e293b;
    --dashboard-text: #f1f5f9;
    --dashboard-text-muted: #94a3b8;
    --dashboard-border: #334155;
    --dashboard-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Base Styles
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--dashboard-font);
    background-color: var(--dashboard-bg);
    color: var(--dashboard-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--dashboard-primary);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* ============================================
   Navigation
   ============================================ */
.dashboard-nav {
    background: var(--dashboard-card-bg) !important;
    border-bottom: 1px solid var(--dashboard-border);
    box-shadow: var(--dashboard-shadow);
}

.dashboard-nav .rsl-navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--dashboard-primary);
    text-decoration: none;
}

.dashboard-nav .brand-icon {
    font-size: 1.5rem;
}

.dashboard-nav .rsl-navbar-link {
    color: var(--dashboard-text-muted);
    font-weight: 500;
    transition: color 0.2s ease;
}

.dashboard-nav .rsl-navbar-link:hover,
.dashboard-nav .rsl-navbar-link[aria-current="page"] {
    color: var(--dashboard-primary);
}

[data-theme="dark"] .dashboard-nav .rsl-navbar-link:hover,
[data-theme="dark"] .dashboard-nav .rsl-navbar-link[aria-current="page"] {
    color: var(--dashboard-primary-light);
}

.dashboard-nav .rsl-navbar-link i {
    margin-right: 0.5rem;
}

.user-menu {
    margin-left: 1rem;
}

.user-avatar {
    background: transparent;
    border: none;
    font-size: 1.75rem;
    color: var(--dashboard-text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.user-avatar:hover {
    color: var(--dashboard-primary);
}

/* ============================================
   Hero Section
   ============================================ */
.dashboard-hero {
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-primary-light) 100%);
    min-height: auto !important;
    padding: 2rem 0;
}

.dashboard-hero .rsl-hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.dashboard-hero .rsl-hero-eyebrow {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.dashboard-hero .rsl-hero-eyebrow i {
    color: #fbbf24;
    margin-right: 0.5rem;
}

.dashboard-hero .rsl-hero-heading {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.dashboard-hero .rsl-hero-subheading {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 0;
}

.hero-date {
    text-align: right;
    color: white;
}

.hero-date .current-date {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

.hero-date .current-time {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .dashboard-hero .rsl-hero-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .hero-date {
        text-align: center;
    }
}

/* ============================================
   Main Container
   ============================================ */
.dashboard-main {
    min-height: calc(100vh - 60px);
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ============================================
   Section Styles
   ============================================ */
.dashboard-section {
    margin-bottom: 2.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dashboard-text);
    margin: 0 0 1.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.section-filters .rsl-filter-input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--dashboard-border);
    border-radius: 8px;
    background: var(--dashboard-card-bg);
    color: var(--dashboard-text);
    min-width: 200px;
}

.section-filters .rsl-filter-input:focus {
    outline: none;
    border-color: var(--dashboard-primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

/* ============================================
   Dashboard Cards
   ============================================ */
.dashboard-card {
    background: var(--dashboard-card-bg);
    border-radius: var(--dashboard-radius);
    box-shadow: var(--dashboard-shadow);
    border: 1px solid var(--dashboard-border);
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--dashboard-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h3 i {
    color: var(--dashboard-primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-link {
    font-size: 0.875rem;
    color: var(--dashboard-primary);
    text-decoration: none;
    font-weight: 500;
}

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

.card-body {
    padding: 1.25rem;
}

/* ============================================
   KPI Cards Customization
   ============================================ */
.rsl-kpi-card {
    background: var(--dashboard-card-bg);
    border-radius: var(--dashboard-radius);
    box-shadow: var(--dashboard-shadow);
    border: 1px solid var(--dashboard-border);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.rsl-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
}

.rsl-kpi-icon i,
.rsl-kpi-icon .fas,
.rsl-kpi-icon .fa,
.rsl-kpi-icon .rsl-icon {
    color: white !important;
    fill: white !important;
}

.rsl-kpi-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rsl-kpi-label {
    font-size: 0.875rem;
    color: var(--dashboard-text-muted);
    font-weight: 500;
}

.rsl-kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dashboard-text);
    font-variant-numeric: tabular-nums;
}

.rsl-kpi-trend {
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.rsl-kpi-trend-up {
    color: var(--dashboard-accent);
}

.rsl-kpi-trend-down {
    color: var(--dashboard-danger);
}

.rsl-kpi-sparkline {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 40px;
    opacity: 0.3;
}

/* ============================================
   Charts
   ============================================ */
.rsl-chart {
    min-height: 300px;
}

.chart-period-select {
    min-width: 140px;
}

/* ============================================
   Events List
   ============================================ */
.upcoming-events-card .card-body {
    padding: 0;
}

.events-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--dashboard-border);
    transition: background-color 0.2s ease;
}

.event-item:last-child {
    border-bottom: none;
}

.event-item:hover {
    background-color: rgba(30, 64, 175, 0.05);
}

[data-theme="dark"] .event-item:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.event-time {
    min-width: 70px;
    text-align: center;
}

.event-time .time {
    display: block;
    font-weight: 600;
    color: var(--dashboard-text);
    font-size: 0.875rem;
}

.event-time .date {
    display: block;
    font-size: 0.75rem;
    color: var(--dashboard-text-muted);
}

.event-details {
    flex: 1;
}

.event-details h4 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--dashboard-text);
}

.event-details p {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: var(--dashboard-text-muted);
}

.event-details p i {
    margin-right: 0.25rem;
}

.event-badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* ============================================
   Smart Table
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

.rsl-smart-table {
    width: 100%;
    border-collapse: collapse;
}

.rsl-smart-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dashboard-text-muted);
    background: var(--dashboard-bg);
    border-bottom: 1px solid var(--dashboard-border);
    white-space: nowrap;
}

.rsl-smart-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--dashboard-border);
    vertical-align: middle;
}

.rsl-smart-table tbody tr:hover {
    background-color: rgba(30, 64, 175, 0.03);
}

[data-theme="dark"] .rsl-smart-table tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
}

.rsl-smart-table code {
    background: var(--dashboard-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    color: var(--dashboard-primary);
}

.customer-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.customer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-primary-light) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.customer-info strong {
    display: block;
    font-size: 0.875rem;
    color: var(--dashboard-text);
}

.customer-info small {
    font-size: 0.75rem;
    color: var(--dashboard-text-muted);
}

/* Table Action Buttons */
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--dashboard-border);
    background: transparent;
    color: var(--dashboard-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--dashboard-primary);
    border-color: var(--dashboard-primary);
    color: white;
}

/* ============================================
   Badges
   ============================================ */
.rsl-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.rsl-badge-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--dashboard-accent);
}

.rsl-badge-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--dashboard-warning);
}

.rsl-badge-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--dashboard-danger);
}

/* ============================================
   Goal Cards
   ============================================ */
.goal-card {
    padding: 1.5rem;
}

.goal-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--dashboard-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.goal-card h4 i {
    color: var(--dashboard-primary);
}

.goal-description {
    font-size: 0.875rem;
    color: var(--dashboard-text-muted);
    margin: 0 0 1rem 0;
}

.goal-card .rsl-progress-bar {
    margin-bottom: 0.75rem;
}

.goal-status {
    font-size: 0.8125rem;
    color: var(--dashboard-text-muted);
    margin: 0;
}

/* ============================================
   User Profile Off-Canvas Panel
   ============================================ */
.profile-header {
    text-align: center;
    padding: 1.5rem 0 1rem;
    border-bottom: 1px solid var(--dashboard-border);
    margin-bottom: 1.5rem;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--dashboard-primary) 0%, var(--dashboard-primary-light) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-large i {
    font-size: 3rem;
    color: white;
}

.profile-name {
    margin: 0 0 0.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dashboard-text);
}

.profile-role {
    margin: 0 0 0.25rem;
    font-size: 0.875rem;
    color: var(--dashboard-primary-light);
    font-weight: 500;
}

.profile-email {
    margin: 0;
    font-size: 0.8rem;
    color: var(--dashboard-text-muted);
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    padding: 1rem 0;
    border-bottom: 1px solid var(--dashboard-border);
    margin-bottom: 1rem;
}

.profile-stat {
    text-align: center;
}

.profile-stat .stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dashboard-primary);
}

.profile-stat .stat-label {
    font-size: 0.75rem;
    color: var(--dashboard-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    color: var(--dashboard-text);
    text-decoration: none;
    transition: all 0.2s ease;
}

.profile-menu-item:hover {
    background: rgba(30, 64, 175, 0.1);
    color: var(--dashboard-primary);
}

.profile-menu-item i:first-child {
    width: 20px;
    text-align: center;
    color: var(--dashboard-text-muted);
}

.profile-menu-item:hover i:first-child {
    color: var(--dashboard-primary);
}

.profile-menu-item i:last-child {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--dashboard-text-muted);
}

.profile-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--dashboard-border);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--dashboard-danger);
    color: var(--dashboard-danger);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline-danger:hover {
    background: var(--dashboard-danger);
    color: white;
}

.btn-full-width {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Dark mode for profile panel */
[data-theme="dark"] .profile-menu-item:hover {
    background: rgba(59, 130, 246, 0.15);
}

/* ============================================
   Off-Canvas Theme Override
   ============================================ */
#user-profile-panel.off-canvas {
    --off-canvas-bg: var(--dashboard-card-bg);
    --off-canvas-heading: var(--dashboard-primary);
    --off-canvas-text: var(--dashboard-text);
    --off-canvas-paragraph: var(--dashboard-text-muted);
    --off-canvas-shadow-color: rgba(30, 64, 175, 0.3);
}

#user-profile-panel .off-canvas-header {
    background: var(--dashboard-card-bg);
    border-bottom: 1px solid var(--dashboard-border);
}

#user-profile-panel .off-canvas-title {
    color: var(--dashboard-primary-light);
}

#user-profile-panel .off-canvas-close {
    color: var(--dashboard-text-muted);
}

#user-profile-panel .off-canvas-close:hover {
    color: var(--dashboard-text);
}

#user-profile-panel .off-canvas-body {
    background: var(--dashboard-card-bg);
}

/* ============================================
   Footer
   ============================================ */
.dashboard-footer {
    background: var(--dashboard-card-bg);
    border-top: 1px solid var(--dashboard-border);
    padding: 1.5rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--dashboard-text-muted);
}

.footer-content a {
    color: var(--dashboard-primary);
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

.footer-nav {
    display: flex;
    gap: 1.5rem;
}

.footer-nav a {
    font-size: 0.875rem;
    color: var(--dashboard-text-muted);
    text-decoration: none;
}

.footer-nav a:hover {
    color: var(--dashboard-primary);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 1024px) {
    .dashboard-container {
        padding: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-filters {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-section {
        margin-bottom: 1.5rem;
    }

    .section-filters {
        flex-direction: column;
    }

    .section-filters .rsl-filter-input {
        width: 100%;
    }

    .rsl-kpi-value {
        font-size: 1.5rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .dashboard-hero .rsl-hero-heading {
        font-size: 1.5rem;
    }

    .hero-date .current-time {
        font-size: 1.5rem;
    }

    .event-item {
        flex-wrap: wrap;
    }

    .event-badge {
        margin-top: 0.5rem;
        margin-left: auto;
    }
}

/* ============================================
   Animations
   ============================================ */
@media (prefers-reduced-motion: no-preference) {
    .dashboard-card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

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

    .rsl-kpi-card {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

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

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
