/* ============================================================================
   Nabdi (نبضي) - Modern User Dashboard Design System
   Enterprise-Grade Profile & Authentication UI
   ============================================================================
   
   Design Principles:
   - Clean, minimal aesthetic with purposeful white space
   - Card-based modular layout for clarity
   - Clear visual hierarchy with consistent spacing
   - RTL-first responsive design
   - WCAG 2.1 AA accessibility compliance
   - Smooth micro-interactions
   ============================================================================ */

/* ============================================================================
   CSS Custom Properties - Dashboard Theme
   ============================================================================ */
:root {
    /* Dashboard Colors */
    --dash-bg: #faf9f7;
    --dash-card: #ffffff;
    --dash-card-hover: #fefefe;
    --dash-border: #e8e5e1;
    --dash-border-light: #f0ede8;
    --dash-shadow: rgba(139, 115, 85, 0.08);
    --dash-shadow-hover: rgba(139, 115, 85, 0.15);
    
    /* Text Colors */
    --dash-text-primary: #2c2416;
    --dash-text-secondary: #6b5d4d;
    --dash-text-muted: #9a8b78;
    --dash-text-link: #8b7355;
    
    /* Accent Colors */
    --dash-accent: #c4a882;
    --dash-accent-hover: #a88b63;
    --dash-accent-light: rgba(196, 168, 130, 0.12);
    --dash-accent-glow: rgba(196, 168, 130, 0.25);
    
    /* Status Colors */
    --dash-success: #4a9d6e;
    --dash-success-bg: rgba(74, 157, 110, 0.1);
    --dash-warning: #d4a84b;
    --dash-warning-bg: rgba(212, 168, 75, 0.1);
    --dash-error: #c45c5c;
    --dash-error-bg: rgba(196, 92, 92, 0.1);
    --dash-info: #5c8bc4;
    --dash-info-bg: rgba(92, 139, 196, 0.1);
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px var(--dash-shadow);
    --shadow-sm: 0 2px 4px var(--dash-shadow);
    --shadow-md: 0 4px 12px var(--dash-shadow);
    --shadow-lg: 0 8px 24px var(--dash-shadow);
    --shadow-xl: 0 16px 40px var(--dash-shadow-hover);
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 500;
    --z-overlay: 400;
    --z-toast: 600;
}

/* ============================================================================
   Base Resets & Layout
   ============================================================================ */
.dashboard-page {
    min-height: 100vh;
    background: var(--dash-bg);
    font-family: var(--font-body, 'Markazi Text', serif);
    color: var(--dash-text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.dash-body {
    min-height: 100vh;
    background: var(--dash-bg);
    font-family: var(--font-body, 'Markazi Text', serif);
    color: var(--dash-text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.dashboard-page *,
.dashboard-page *::before,
.dashboard-page *::after,
.dash-body *,
.dash-body *::before,
.dash-body *::after {
    box-sizing: border-box;
}

/* ============================================================================
   Dashboard Header - Clean & Minimal
   ============================================================================ */
.dash-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 249, 247, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--dash-border-light);
    height: 60px;
}

.dash-header-inner {
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
}

.dash-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.dash-logo:hover {
    transform: scale(1.03);
}

.dash-logo-img {
    width: 32px;
    height: 32px;
}

.dash-logo-text {
    font-family: var(--font-display, 'Scheherazade New', serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dash-text-primary);
}

/* Desktop Navigation */
.dash-nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    background: var(--dash-bg);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--dash-border-light);
}

.dash-nav-link {
    position: relative;
    color: var(--dash-text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.dash-nav-link::after {
    display: none;
}

.dash-nav-link:hover {
    color: var(--dash-text-primary);
    background: rgba(196, 168, 130, 0.1);
}

.dash-nav-link.active {
    color: white;
    background: linear-gradient(135deg, var(--dash-accent) 0%, var(--dash-accent-hover) 100%);
    box-shadow: 0 2px 6px rgba(196, 168, 130, 0.3);
}

.dash-user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Wrapper elements for dropdowns */
.dash-notifications-wrapper,
.dash-user-avatar-wrapper {
    position: relative;
}

.dash-notifications-btn {
    position: relative;
    width: 36px;
    height: 36px;
    background: var(--dash-card);
    border: 1px solid var(--dash-border-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--dash-text-secondary);
    transition: all var(--transition-fast);
}

.dash-notifications-btn:hover {
    background: var(--dash-accent-light);
    border-color: var(--dash-accent);
    color: var(--dash-accent);
}

.dash-notifications-btn svg {
    width: 18px;
    height: 18px;
}

.dash-notification-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 16px;
    height: 16px;
    background: var(--dash-error);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
}

.dash-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--dash-accent) 0%, var(--dash-accent-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.dash-user-avatar:hover {
    box-shadow: 0 0 0 3px var(--dash-accent-light);
    transform: scale(1.05);
}

/* Mobile Menu Toggle */
.dash-menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    background: var(--dash-card);
    border: 1px solid var(--dash-border-light);
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--dash-text-primary);
    transition: all var(--transition-fast);
}

.dash-menu-toggle:hover {
    background: var(--dash-accent-light);
    border-color: var(--dash-accent);
}

.dash-menu-toggle svg {
    width: 20px;
    height: 20px;
}

/* ============================================================================
   Dashboard Layout - Grid System
   ============================================================================ */
.dash-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

.dash-grid {
    display: grid;
    gap: var(--space-lg);
}

.dash-grid-sidebar {
    grid-template-columns: 280px 1fr;
}

.dash-grid-main {
    grid-template-columns: 1fr;
}

/* ============================================================================
   User Profile Card - Hero Section
   ============================================================================ */
.profile-hero {
    background: var(--dash-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--dash-border-light);
}

.profile-hero-inner {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--dash-accent) 0%, var(--dash-accent-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    font-weight: 600;
    font-family: var(--font-display, 'Scheherazade New', serif);
    box-shadow: var(--shadow-md);
}

.profile-avatar-edit {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 32px;
    height: 32px;
    background: var(--dash-card);
    border: 2px solid var(--dash-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-avatar-edit:hover {
    background: var(--dash-accent-light);
    border-color: var(--dash-accent);
}

.profile-avatar-edit svg {
    width: 14px;
    height: 14px;
    color: var(--dash-text-secondary);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name-display {
    font-family: var(--font-display, 'Scheherazade New', serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-xs);
    line-height: 1.3;
}

.profile-email-display {
    font-size: 0.95rem;
    color: var(--dash-text-muted);
    margin: 0 0 var(--space-md);
}

.profile-bio-display {
    font-size: 1rem;
    color: var(--dash-text-secondary);
    margin: 0;
    line-height: 1.7;
}

.profile-stats {
    display: flex;
    gap: var(--space-xl);
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--dash-border-light);
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    font-family: var(--font-display);
}

.profile-stat-label {
    font-size: 0.85rem;
    color: var(--dash-text-muted);
}

.profile-actions-hero {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    flex-shrink: 0;
}

/* ============================================================================
   Dashboard Cards
   ============================================================================ */
.dash-card {
    background: var(--dash-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--dash-border-light);
    transition: all var(--transition-base);
}

.dash-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--dash-border);
}

.dash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.dash-card-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.dash-card-title-icon {
    width: 20px;
    height: 20px;
    color: var(--dash-accent);
}

.dash-card-action {
    font-size: 0.85rem;
    color: var(--dash-text-link);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.dash-card-action:hover {
    color: var(--dash-accent-hover);
}

/* ============================================================================
   Tab Navigation - Modern Pills
   ============================================================================ */
.dash-tabs {
    display: flex;
    gap: var(--space-sm);
    background: var(--dash-card);
    padding: var(--space-sm);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--dash-border-light);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.dash-tabs::-webkit-scrollbar {
    display: none;
}

.dash-tab {
    flex: 1;
    min-width: max-content;
    padding: var(--space-sm) var(--space-lg);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dash-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.dash-tab:hover {
    background: var(--dash-accent-light);
    color: var(--dash-text-primary);
}

.dash-tab.active {
    background: var(--dash-accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.dash-tab-icon {
    display: inline-block;
    margin-left: var(--space-xs);
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

/* Tab Content */
.tab-content-container {
    position: relative;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   Content Grids
   ============================================================================ */
.dash-content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.dash-content-grid-large {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

/* ============================================================================
   Poem Cards - Enhanced Design
   ============================================================================ */
.poem-card-dash {
    background: var(--dash-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--dash-border-light);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.poem-card-dash::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--dash-accent);
    transform: scaleY(0);
    transition: transform var(--transition-base);
}

.poem-card-dash:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--dash-accent);
}

.poem-card-dash:hover::before {
    transform: scaleY(1);
}

.poem-card-category {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dash-accent-hover);
    background: var(--dash-accent-light);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-sm);
}

.poem-card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-sm);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.poem-card-excerpt {
    font-size: 0.9rem;
    color: var(--dash-text-secondary);
    margin: 0 0 var(--space-md);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.poem-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--dash-text-muted);
}

.poem-card-author {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.poem-card-date {
    opacity: 0.8;
}

.poem-card-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--dash-border-light);
}

.poem-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm);
    background: transparent;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--dash-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.poem-action-btn:hover {
    background: var(--dash-accent-light);
    border-color: var(--dash-accent);
    color: var(--dash-accent-hover);
}

.poem-action-btn.active {
    background: var(--dash-accent);
    border-color: var(--dash-accent);
    color: white;
}

.poem-action-btn svg {
    width: 14px;
    height: 14px;
}

/* ============================================================================
   Collection Cards
   ============================================================================ */
.collection-card-dash {
    background: var(--dash-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--dash-border-light);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
}

.collection-card-dash:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--dash-accent);
}

.collection-card-dash:hover .collection-card-actions {
    opacity: 1;
}

.collection-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.collection-card-actions {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-sm);
    display: flex;
    gap: var(--space-xs);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.collection-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--dash-border);
    background: var(--dash-card);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.collection-action-btn:hover {
    background: var(--dash-accent-light);
    border-color: var(--dash-accent);
}

.collection-action-btn svg {
    width: 16px;
    height: 16px;
    color: var(--dash-text-secondary);
}

.collection-action-btn:hover svg {
    color: var(--dash-accent-hover);
}

.collection-action-delete:hover {
    background: var(--dash-error-bg);
    border-color: var(--dash-error);
}

.collection-action-delete:hover svg {
    color: var(--dash-error);
}

.collection-card-icon {
    width: 48px;
    height: 48px;
    background: var(--dash-accent-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.collection-card-icon svg {
    width: 24px;
    height: 24px;
    color: var(--dash-accent-hover);
}

.collection-card-name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-xs);
}

.collection-card-count {
    font-size: 0.85rem;
    color: var(--dash-text-muted);
}

.collection-card-add {
    border: 2px dashed var(--dash-border);
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.collection-card-add:hover {
    border-color: var(--dash-accent);
    background: var(--dash-accent-light);
}

.collection-card-add-icon {
    width: 40px;
    height: 40px;
    border: 2px solid var(--dash-border);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-sm);
    transition: all var(--transition-fast);
}

.collection-card-add:hover .collection-card-add-icon {
    border-color: var(--dash-accent);
    background: var(--dash-accent);
}

.collection-card-add-icon svg {
    width: 20px;
    height: 20px;
    color: var(--dash-text-muted);
    transition: color var(--transition-fast);
}

.collection-card-add:hover .collection-card-add-icon svg {
    color: white;
}

.collection-card-add-text {
    font-size: 0.9rem;
    color: var(--dash-text-secondary);
}

/* ============================================================================
   Quick Stats Cards
   ============================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--dash-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--dash-border-light);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon svg {
    width: 24px;
    height: 24px;
}

.stat-card-icon.purple {
    background: rgba(139, 92, 196, 0.12);
    color: #8b5cc4;
}

.stat-card-icon.blue {
    background: rgba(92, 139, 196, 0.12);
    color: #5c8bc4;
}

.stat-card-icon.green {
    background: rgba(74, 157, 110, 0.12);
    color: #4a9d6e;
}

.stat-card-icon.orange {
    background: rgba(212, 168, 75, 0.12);
    color: #d4a84b;
}

.stat-card-content {
    flex: 1;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    line-height: 1.2;
    margin-bottom: var(--space-xs);
}

.stat-card-label {
    font-size: 0.85rem;
    color: var(--dash-text-muted);
}

.stat-card-trend {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    margin-top: var(--space-xs);
}

.stat-card-trend.up {
    color: var(--dash-success);
}

.stat-card-trend.down {
    color: var(--dash-error);
}

/* ============================================================================
   Activity Feed
   ============================================================================ */
.activity-feed {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--dash-border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-icon.read {
    background: var(--dash-info-bg);
    color: var(--dash-info);
}

.activity-icon.favorite {
    background: var(--dash-error-bg);
    color: var(--dash-error);
}

.activity-icon.collection {
    background: var(--dash-success-bg);
    color: var(--dash-success);
}

.activity-icon.note {
    background: var(--dash-warning-bg);
    color: var(--dash-warning);
}

.activity-icon svg {
    width: 16px;
    height: 16px;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-text {
    font-size: 0.9rem;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-xs);
}

.activity-text strong {
    color: var(--dash-accent-hover);
    font-weight: 600;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--dash-text-muted);
}

/* ============================================================================
   Empty States
   ============================================================================ */
.empty-state-dash {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--dash-accent-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-lg);
}

.empty-state-icon svg {
    width: 36px;
    height: 36px;
    color: var(--dash-accent);
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-sm);
}

.empty-state-text {
    font-size: 0.95rem;
    color: var(--dash-text-secondary);
    margin: 0 0 var(--space-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================================
   Loading States
   ============================================================================ */
.loading-state-dash {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--dash-border);
    border-top-color: var(--dash-accent);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: var(--space-md);
    font-size: 0.9rem;
    color: var(--dash-text-muted);
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--dash-border-light) 25%,
        var(--dash-bg) 50%,
        var(--dash-border-light) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 180px;
    border-radius: var(--radius-lg);
}

.skeleton-line {
    height: 16px;
    margin-bottom: var(--space-sm);
}

.skeleton-line.short {
    width: 60%;
}

/* ============================================================================
   Buttons - Modern Design
   ============================================================================ */
.btn-dash {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    border: none;
}

.btn-dash-primary {
    background: linear-gradient(135deg, var(--dash-accent) 0%, var(--dash-accent-hover) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(196, 168, 130, 0.3);
}

.btn-dash-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(196, 168, 130, 0.4);
}

.btn-dash-secondary {
    background: var(--dash-card);
    color: var(--dash-text-primary);
    border: 1px solid var(--dash-border);
}

.btn-dash-secondary:hover {
    background: var(--dash-accent-light);
    border-color: var(--dash-accent);
}

.btn-dash-ghost {
    background: transparent;
    color: var(--dash-text-link);
}

.btn-dash-ghost:hover {
    background: var(--dash-accent-light);
    color: var(--dash-accent-hover);
}

.btn-dash-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 0.8rem;
}

.btn-dash-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
}

.btn-dash-full {
    width: 100%;
}

.btn-dash-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-dash-icon svg {
    width: 18px;
    height: 18px;
}

/* ============================================================================
   Forms - Clean Input Styles
   ============================================================================ */
.form-group-dash {
    margin-bottom: var(--space-lg);
}

.form-label-dash {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dash-text-primary);
    margin-bottom: var(--space-sm);
}

.form-input-dash {
    width: 100%;
    padding: var(--space-md);
    font-size: 1rem;
    border: 1px solid var(--dash-border);
    border-radius: var(--radius-md);
    background: var(--dash-card);
    color: var(--dash-text-primary);
    transition: all var(--transition-fast);
}

.form-input-dash:focus {
    outline: none;
    border-color: var(--dash-accent);
    box-shadow: 0 0 0 3px var(--dash-accent-light);
}

.form-input-dash::placeholder {
    color: var(--dash-text-muted);
}

.form-textarea-dash {
    min-height: 120px;
    resize: vertical;
}

.form-select-dash {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b5d4d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left var(--space-md) center;
    background-size: 16px;
    padding-left: 2.5rem;
}

.form-hint-dash {
    font-size: 0.8rem;
    color: var(--dash-text-muted);
    margin-top: var(--space-xs);
}

.form-error-dash {
    font-size: 0.8rem;
    color: var(--dash-error);
    margin-top: var(--space-xs);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dash-grid-sidebar {
        grid-template-columns: 1fr;
    }
    
    .profile-hero-inner {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-stats {
        justify-content: center;
    }
    
    .profile-actions-hero {
        flex-direction: row;
    }
}

@media (max-width: 768px) {
    .dash-header-inner {
        padding: 0 var(--space-md);
    }
    
    .dash-nav {
        display: none;
        position: fixed;
        top: 60px;
        right: 0;
        left: 0;
        background: var(--dash-card);
        flex-direction: column;
        padding: var(--space-lg);
        border-bottom: 1px solid var(--dash-border);
        box-shadow: var(--shadow-lg);
        gap: var(--space-md);
        z-index: var(--z-dropdown);
    }
    
    .dash-nav.active,
    .dash-nav.open {
        display: flex;
    }
    
    .dash-nav-link {
        padding: var(--space-md);
        text-align: center;
        background: var(--dash-bg);
        border-radius: var(--radius-md);
    }
    
    .dash-menu-toggle {
        display: flex;
    }
    
    .dash-layout {
        padding: var(--space-lg) var(--space-md);
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-md);
    }
    
    .stat-card {
        padding: var(--space-md);
    }
    
    .stat-card-value {
        font-size: 1.5rem;
    }
    
    .dash-tabs {
        padding: var(--space-xs);
        gap: var(--space-xs);
    }
    
    .dash-tab {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.85rem;
    }
    
    .profile-hero {
        padding: var(--space-lg);
    }
    
    .profile-avatar-large {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .profile-name-display {
        font-size: 1.4rem;
    }
    
    .dash-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-stats {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .profile-actions-hero {
        flex-direction: column;
        width: 100%;
    }
    
    .profile-actions-hero .btn-dash {
        width: 100%;
    }
    
    .dash-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .dash-tab {
        flex: 0 0 auto;
    }
}

/* ============================================================================
   Auth Pages - Modern Clean Design
   ============================================================================ */
.auth-page-modern {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dash-bg);
    padding: var(--space-lg);
}

.auth-container-modern {
    width: 100%;
    max-width: 440px;
}

.auth-card-modern {
    background: var(--dash-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--dash-border-light);
}

.auth-header-modern {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-logo-modern {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.auth-logo-modern img {
    width: 48px;
    height: 48px;
}

.auth-title-modern {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-sm);
}

.auth-subtitle-modern {
    font-size: 0.95rem;
    color: var(--dash-text-secondary);
    margin: 0;
}

.auth-form-modern {
    margin-bottom: var(--space-lg);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    color: var(--dash-text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--dash-border);
}

.auth-footer-modern {
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--dash-border-light);
}

.auth-footer-modern p {
    font-size: 0.9rem;
    color: var(--dash-text-secondary);
    margin: 0;
}

.auth-footer-modern a {
    color: var(--dash-accent-hover);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer-modern a:hover {
    text-decoration: underline;
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--dash-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--dash-border-light);
    pointer-events: auto;
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.toast-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success {
    border-right: 4px solid var(--dash-success);
}

.toast.success .toast-icon {
    color: var(--dash-success);
}

.toast.error {
    border-right: 4px solid var(--dash-error);
}

.toast.error .toast-icon {
    color: var(--dash-error);
}

.toast.warning {
    border-right: 4px solid var(--dash-warning);
}

.toast.warning .toast-icon {
    color: var(--dash-warning);
}

.toast.info {
    border-right: 4px solid var(--dash-info);
}

.toast.info .toast-icon {
    color: var(--dash-info);
}

.toast-message {
    font-size: 0.9rem;
    color: var(--dash-text-primary);
}

.toast-close {
    background: none;
    border: none;
    padding: var(--space-xs);
    cursor: pointer;
    color: var(--dash-text-muted);
    margin-right: calc(var(--space-sm) * -1);
}

.toast-close:hover {
    color: var(--dash-text-primary);
}

/* ============================================================================
   Print Styles
   ============================================================================ */
@media print {
    .dash-header,
    .dash-tabs,
    .profile-actions-hero,
    .poem-card-actions,
    .btn-dash {
        display: none !important;
    }
    
    .dash-card,
    .profile-hero {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================================================
   Settings Page Styles
   ============================================================================ */
.settings-main {
    padding-top: calc(var(--dash-header-height) + var(--space-2xl));
}

.settings-page-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.settings-page-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-sm);
}

.settings-title-icon {
    width: 32px;
    height: 32px;
    color: var(--dash-accent);
}

.settings-page-subtitle {
    font-size: 1rem;
    color: var(--dash-text-secondary);
    margin: 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
        padding: 0 var(--space-md);
    }
}

.settings-form-dash {
    display: flex;
    flex-direction: column;
}

.form-error-dash {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: var(--radius-md);
    color: var(--dash-error);
    font-size: 0.9rem;
}

/* Checkbox Styles */
.checkbox-label-dash {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--dash-text-primary);
    padding: var(--space-sm) 0;
}

.checkbox-label-dash input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--dash-accent);
    cursor: pointer;
}

/* Danger Zone Card */
.dash-card-danger {
    border-color: rgba(220, 53, 69, 0.3);
    background: linear-gradient(135deg, 
        var(--dash-card) 0%, 
        rgba(220, 53, 69, 0.03) 100%
    );
}

.dash-card-danger .dash-card-title {
    color: var(--dash-error);
}

.danger-warning-dash {
    font-size: 0.9rem;
    color: var(--dash-text-secondary);
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.btn-dash-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-dash-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Back Link */
.dash-back-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    color: var(--dash-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.dash-back-link:hover {
    color: var(--dash-accent);
}

.dash-back-link svg {
    flex-shrink: 0;
}

/* Form Textarea */
.form-textarea-dash {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

/* Disabled Input */
.form-input-dash:disabled {
    background: var(--dash-bg);
    color: var(--dash-text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}
/* ============================================================================
   Poem Card Links - Reset anchor styles inside cards
   ============================================================================ */
.poem-card-dash a,
.poem-card-link,
.collection-card-link,
.note-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.poem-card-dash a:hover,
.poem-card-link:hover,
.collection-card-link:hover,
.note-card-link:hover {
    text-decoration: none;
    color: inherit;
}

/* ============================================================================
   Note Cards - For user notes display
   ============================================================================ */
.note-card-dash {
    background: var(--dash-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--dash-border-light);
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    border-right: 4px solid var(--dash-warning);
}

.note-card-dash:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--dash-accent);
    border-right-color: var(--dash-accent);
}

.note-card-dash a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.note-poem-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--dash-text-primary);
    margin: 0 0 var(--space-sm);
    line-height: 1.4;
}

.note-content {
    font-size: 0.9rem;
    color: var(--dash-text-secondary);
    margin: 0 0 var(--space-md);
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-date {
    display: block;
    font-size: 0.8rem;
    color: var(--dash-text-muted);
}

/* ============================================================================
   Form Utilities
   ============================================================================ */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.form-actions-dash {
    display: flex;
    gap: var(--space-md);
    padding-top: var(--space-md);
}

.form-hint-dash {
    display: block;
    font-size: 0.8rem;
    color: var(--dash-text-muted);
    margin-top: var(--space-xs);
}

.form-textarea-dash {
    min-height: 150px;
    resize: vertical;
    line-height: 1.7;
}

/* ============================================================================
   Modal Styles
   ============================================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-lg);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--dash-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--dash-border-light);
}

.modal-title {
    font-family: var(--font-display, 'Scheherazade New', serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dash-text-primary);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--dash-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--dash-accent-light);
    color: var(--dash-text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-top: 1px solid var(--dash-border-light);
    background: var(--dash-bg);
}

/* ============================================================================
   Loading States
   ============================================================================ */
.stat-card-value.loading,
.profile-stat-value.loading {
    background: linear-gradient(90deg, var(--dash-border-light) 25%, var(--dash-border) 50%, var(--dash-border-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    color: transparent !important;
    border-radius: var(--radius-sm);
    min-width: 40px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.profile-hero.loaded .profile-name-display,
.profile-hero.loaded .profile-email-display {
    animation: fadeInUp 0.4s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#statsSection.loaded .stat-card {
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#statsSection.loaded .stat-card:nth-child(1) { animation-delay: 0ms; }
#statsSection.loaded .stat-card:nth-child(2) { animation-delay: 50ms; }
#statsSection.loaded .stat-card:nth-child(3) { animation-delay: 100ms; }
#statsSection.loaded .stat-card:nth-child(4) { animation-delay: 150ms; }

/* ============================================================================
   Avatar Styles
   ============================================================================ */
.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--dash-accent), var(--dash-accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.profile-avatar-large .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.dash-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--dash-accent), var(--dash-accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.dash-user-avatar:hover {
    transform: scale(1.05);
}

/* ============================================================================
   Form Input Error State
   ============================================================================ */
.form-input-dash.error {
    border-color: var(--dash-error);
    background-color: var(--dash-error-bg);
}

.form-input-dash.error:focus {
    box-shadow: 0 0 0 3px rgba(196, 92, 92, 0.15);
}

/* ============================================================================
   Responsive Improvements
   ============================================================================ */
@media (max-width: 768px) {
    .modal-overlay {
        padding: var(--space-md);
        align-items: flex-end;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 85vh;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn-dash {
        width: 100%;
    }
}

/* ============================================================================
   Dashboard Toast Notifications
   ============================================================================ */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--dash-text-primary);
    color: white;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease forwards;
    min-width: 250px;
    max-width: 400px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.toast-out {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.toast.success {
    background: var(--dash-success);
}

.toast.error {
    background: var(--dash-error);
}

.toast.warning {
    background: var(--dash-warning);
    color: var(--dash-text-primary);
}

.toast.info {
    background: var(--dash-info);
}

.toast-message {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: var(--radius-full);
    color: inherit;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================================================
   Button Loading State
   ============================================================================ */
.btn-dash .btn-loader {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.btn-dash .btn-loader::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-dash:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ============================================================================
   ENHANCED MOBILE-FIRST RESPONSIVE DESIGN
   Making profile.html app-like for mobile users (8/10+)
   ============================================================================ */

/* Mobile Bottom Navigation Bar - App-like */
.mobile-profile-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Show mobile bottom nav on mobile only */
    .mobile-profile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 249, 247, 0.98) 100%);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--dash-border-light);
        box-shadow: 0 -4px 20px rgba(139, 115, 85, 0.08);
        padding: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 500;
        justify-content: space-around;
        align-items: center;
    }
    
    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 12px;
        background: none;
        border: none;
        border-radius: var(--radius-md);
        color: var(--dash-text-muted);
        text-decoration: none;
        font-size: 0.7rem;
        font-weight: 500;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        min-width: 56px;
    }
    
    .mobile-nav-item svg {
        width: 22px;
        height: 22px;
        transition: transform 0.2s ease;
    }
    
    .mobile-nav-item:hover,
    .mobile-nav-item:active {
        color: var(--dash-accent-hover);
        background: var(--dash-accent-light);
    }
    
    .mobile-nav-item.active {
        color: var(--dash-accent);
    }
    
    .mobile-nav-item.active svg {
        transform: scale(1.1);
    }
    
    /* Profile nav item with dropdown menu */
    .mobile-nav-profile {
        position: relative;
    }
    
    .profile-menu-popup {
        position: absolute;
        bottom: calc(100% + 12px);
        left: 50%;
        transform: translateX(-50%);
        background: var(--dash-card);
        border-radius: var(--radius-lg);
        box-shadow: 0 -8px 32px rgba(139, 115, 85, 0.25);
        border: 1px solid var(--dash-border-light);
        padding: var(--space-sm);
        min-width: 180px;
        display: none;
        z-index: 1000;
    }
    
    .profile-menu-popup.active {
        display: block;
    }
    
    .profile-menu-popup::after {
        content: '';
        position: absolute;
        bottom: -8px;
        left: 50%;
        transform: translateX(-50%);
        border: 8px solid transparent;
        border-top-color: var(--dash-card);
    }
    
    .profile-menu-item {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        padding: var(--space-md) var(--space-lg);
        color: var(--dash-text-primary);
        text-decoration: none;
        border-radius: var(--radius-md);
        transition: background 0.15s ease;
        font-size: 0.95rem;
        white-space: nowrap;
    }
    
    .profile-menu-item svg {
        width: 18px;
        height: 18px;
        color: var(--dash-text-muted);
    }
    
    .profile-menu-item:hover,
    .profile-menu-item:active {
        background: var(--dash-accent-light);
    }
    
    .profile-menu-item:hover svg {
        color: var(--dash-accent);
    }
    
    .profile-menu-divider {
        height: 1px;
        background: var(--dash-border-light);
        margin: var(--space-xs) 0;
    }
    
    /* Add padding to main content to account for bottom nav */
    .dash-layout {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    /* Hide desktop footer on mobile */
    .dash-footer {
        display: none !important;
    }
    
    /* Hide desktop header nav on mobile - show hamburger menu */
    .dash-nav {
        display: none !important;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--dash-card);
        flex-direction: column;
        padding: var(--space-md);
        border-bottom: 1px solid var(--dash-border-light);
        box-shadow: 0 8px 24px rgba(139, 115, 85, 0.15);
        gap: var(--space-xs);
        z-index: var(--z-dropdown);
    }
    
    .dash-nav.active {
        display: flex !important;
    }
    
    .dash-nav-link {
        padding: var(--space-md);
        text-align: center;
        border-radius: var(--radius-md);
        background: var(--dash-bg);
    }
    
    .dash-nav-link.active {
        background: linear-gradient(135deg, var(--dash-accent) 0%, var(--dash-accent-hover) 100%);
        color: white;
    }
    
    /* Show mobile menu toggle */
    .dash-menu-toggle {
        display: flex !important;
    }
    
    /* Mobile header adjustments */
    .dash-header {
        height: 56px;
    }
    
    .dash-header-inner {
        padding: 0 var(--space-md);
    }
    
    .dash-logo-img {
        width: 28px;
        height: 28px;
    }
    
    .dash-logo-text {
        font-size: 1.1rem;
    }
    
    /* Hide logout button text on mobile */
    #logoutBtn {
        display: none;
    }
    
    .dash-notifications-btn {
        width: 36px;
        height: 36px;
    }
    
    .dash-user-avatar {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
    }
    
    /* Mobile Profile Dropdown - same as desktop but positioned for mobile */
    .dash-user-avatar-wrapper {
        position: relative;
    }
    
    .desktop-profile-dropdown {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: auto;
        background: var(--dash-card);
        border-radius: var(--radius-lg);
        box-shadow: 0 12px 40px rgba(139, 115, 85, 0.25);
        border: 1px solid var(--dash-border-light);
        padding: var(--space-sm);
        min-width: 180px;
        display: none;
        z-index: 1000;
    }
    
    .desktop-profile-dropdown.active {
        display: block;
    }
    
    .profile-dropdown-item {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
        color: var(--dash-text-primary);
        text-decoration: none;
        border-radius: var(--radius-md);
        transition: background 0.15s ease;
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .profile-dropdown-item svg {
        width: 16px;
        height: 16px;
        color: var(--dash-text-muted);
        flex-shrink: 0;
    }
    
    .profile-dropdown-item:hover,
    .profile-dropdown-item:active {
        background: var(--dash-accent-light);
    }
    
    .profile-dropdown-item.danger {
        color: var(--dash-error);
    }
    
    .profile-dropdown-item.danger svg {
        color: var(--dash-error);
    }
    
    .profile-dropdown-divider {
        height: 1px;
        background: var(--dash-border-light);
        margin: var(--space-xs) 0;
    }
}

/* ============================================================================
   DESKTOP HEADER ENHANCEMENTS
   ============================================================================ */
@media (min-width: 769px) {
    /* Desktop Profile Dropdown Menu */
    .desktop-profile-dropdown {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: auto;
        background: var(--dash-card);
        border-radius: var(--radius-lg);
        box-shadow: 0 12px 40px rgba(139, 115, 85, 0.25);
        border: 1px solid var(--dash-border-light);
        padding: var(--space-sm);
        min-width: 200px;
        display: none;
        z-index: 1000;
    }
    
    .dash-user-avatar-wrapper:hover .desktop-profile-dropdown,
    .desktop-profile-dropdown.active {
        display: block;
    }
    
    .profile-dropdown-item {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        padding: var(--space-md) var(--space-lg);
        color: var(--dash-text-primary);
        text-decoration: none;
        border-radius: var(--radius-md);
        transition: all 0.15s ease;
        font-size: 0.95rem;
    }
    
    .profile-dropdown-item svg {
        width: 18px;
        height: 18px;
        color: var(--dash-text-muted);
    }
    
    .profile-dropdown-item:hover {
        background: var(--dash-accent-light);
    }
    
    .profile-dropdown-item:hover svg {
        color: var(--dash-accent);
    }
    
    .profile-dropdown-divider {
        height: 1px;
        background: var(--dash-border-light);
        margin: var(--space-xs) 0;
    }
    
    .profile-dropdown-item.danger {
        color: var(--dash-error);
    }
    
    .profile-dropdown-item.danger svg {
        color: var(--dash-error);
    }
    
    .profile-dropdown-item.danger:hover {
        background: var(--dash-error-bg);
    }
}

/* ============================================================================
   IMPROVED DASH-FOOTER STYLING
   Modern, clean footer design
   ============================================================================ */
.dash-footer {
    background: linear-gradient(180deg, var(--dash-bg) 0%, rgba(232, 230, 223, 0.6) 100%);
    border-top: 1px solid var(--dash-border-light);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    margin-top: auto;
}

.dash-footer p {
    font-size: 0.9rem;
    color: var(--dash-text-muted);
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.dash-footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-top: var(--space-md);
}

.dash-footer-link {
    color: var(--dash-text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.dash-footer-link:hover {
    color: var(--dash-accent);
}

/* ============================================================================
   CREATE COLLECTION BUTTON - IMPROVED STYLING
   ============================================================================ */
.dash-card-action#createCollectionBtn,
#createCollectionBtn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, var(--dash-accent) 0%, var(--dash-accent-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(196, 168, 130, 0.3);
}

.dash-card-action#createCollectionBtn:hover,
#createCollectionBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(196, 168, 130, 0.4);
}

/* ============================================================================
   NOTIFICATIONS BUTTON - FIXED FUNCTIONALITY
   ============================================================================ */
.dash-notifications-btn {
    position: relative;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    background: var(--dash-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(139, 115, 85, 0.25);
    border: 1px solid var(--dash-border-light);
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: 400px;
    overflow: hidden;
    display: none;
    z-index: 1000;
}

.notifications-dropdown.active {
    display: block;
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--dash-border-light);
}

.notifications-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--dash-text-primary);
}

.mark-all-read {
    font-size: 0.8rem;
    color: var(--dash-accent);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.mark-all-read:hover {
    color: var(--dash-accent-hover);
}

.notifications-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--dash-border-light);
    transition: background 0.15s ease;
    cursor: pointer;
}

.notification-item:hover {
    background: var(--dash-bg);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--dash-accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon svg {
    width: 18px;
    height: 18px;
    color: var(--dash-accent);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 0.9rem;
    color: var(--dash-text-primary);
    margin: 0;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--dash-text-muted);
    margin-top: 2px;
}

.notifications-empty {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--dash-text-muted);
}

.notifications-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

/* ============================================================================
   ENHANCED MOBILE RESPONSIVE STYLES
   App-like experience for mobile users
   ============================================================================ */
@media (max-width: 768px) {
    /* Full-width dashboard layout */
    .dash-layout {
        padding: var(--space-md);
        padding-top: var(--space-lg);
    }
    
    /* Header optimization - fixed height */
    .dash-header {
        height: 56px;
        padding: 0;
    }
    
    .dash-header-inner {
        padding: 0 var(--space-md);
        height: 100%;
    }
    
    .dash-logo-text {
        font-size: 1.15rem;
    }
    
    .dash-logo-img {
        width: 32px;
        height: 32px;
    }
    
    /* Hide logout button on mobile - use menu instead */
    .dash-user-menu #logoutBtn {
        display: none;
    }
    
    /* Profile Hero - Mobile optimized */
    .profile-hero {
        padding: var(--space-lg);
        margin-bottom: var(--space-lg);
        border-radius: var(--radius-lg);
    }
    
    .profile-hero-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-lg);
    }
    
    .profile-avatar-large {
        width: 80px;
        height: 80px;
        font-size: 1.75rem;
    }
    
    .profile-avatar-edit {
        width: 28px;
        height: 28px;
    }
    
    .profile-avatar-edit svg {
        width: 12px;
        height: 12px;
    }
    
    .profile-name-display {
        font-size: 1.35rem;
    }
    
    .profile-email-display {
        font-size: 0.9rem;
    }
    
    .profile-bio-display {
        font-size: 0.95rem;
    }
    
    .profile-stats {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        padding-top: var(--space-md);
        gap: var(--space-lg);
    }
    
    .profile-stat {
        flex: 1;
    }
    
    .profile-stat-value {
        font-size: 1.35rem;
    }
    
    .profile-stat-label {
        font-size: 0.8rem;
    }
    
    .profile-actions-hero {
        flex-direction: row;
        width: 100%;
        gap: var(--space-sm);
    }
    
    .profile-actions-hero .btn-dash {
        flex: 1;
        justify-content: center;
        padding: var(--space-sm) var(--space-md);
        font-size: 0.85rem;
    }
    
    .profile-actions-hero .btn-dash svg {
        width: 16px;
        height: 16px;
    }
    
    /* Stats Grid - Mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
        margin-bottom: var(--space-lg);
    }
    
    .stat-card {
        padding: var(--space-md);
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--space-sm);
    }
    
    .stat-card-icon {
        width: 40px;
        height: 40px;
    }
    
    .stat-card-icon svg {
        width: 20px;
        height: 20px;
    }
    
    .stat-card-value {
        font-size: 1.4rem;
    }
    
    .stat-card-label {
        font-size: 0.75rem;
    }
    
    /* Tabs - Horizontal scrollable */
    .dash-tabs {
        margin: 0 calc(-1 * var(--space-md));
        padding: var(--space-xs) var(--space-md);
        margin-bottom: var(--space-lg);
        border-radius: 0;
        border-left: none;
        border-right: none;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .dash-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .dash-tab {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .dash-tab-icon {
        width: 16px;
        height: 16px;
        margin-left: var(--space-xs);
    }
    
    /* Cards */
    .dash-card {
        padding: var(--space-md);
        border-radius: var(--radius-md);
        margin-bottom: var(--space-md);
    }
    
    .dash-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
        margin-bottom: var(--space-md);
    }
    
    .dash-card-title {
        font-size: 1.05rem;
    }
    
    .dash-card-title-icon {
        width: 18px;
        height: 18px;
    }
    
    /* Content Grid - 2 columns on mobile for better space usage */
    .dash-content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    .dash-content-grid-large {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
    
    /* Poem Cards - More compact for 2-column layout */
    .poem-card-dash {
        padding: var(--space-sm);
    }
    
    .poem-card-title {
        font-size: 0.9rem;
    }
    
    .poem-card-excerpt {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }
    
    .poem-card-meta {
        font-size: 0.7rem;
        margin-top: var(--space-xs);
    }
    
    .poem-card-actions {
        opacity: 1;
        position: static;
        margin-top: var(--space-xs);
    }
    
    .poem-action-btn {
        width: 28px;
        height: 28px;
    }
    
    .poem-action-btn svg {
        width: 12px;
        height: 12px;
    }
    
    /* Collection Cards - More compact for 2-column layout */
    .collection-card-dash {
        padding: var(--space-sm);
    }
    
    .collection-card-icon {
        width: 36px;
        height: 36px;
        margin-bottom: var(--space-xs);
    }
    
    .collection-card-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .collection-card-name {
        font-size: 0.9rem;
    }
    
    .collection-card-count {
        font-size: 0.75rem;
    }
    
    .collection-card-actions {
        opacity: 1;
        position: static;
        margin-top: var(--space-xs);
    }
    
    .collection-action-btn {
        width: 28px;
        height: 28px;
    }
    
    .collection-action-btn svg {
        width: 14px;
        height: 14px;
    }
    
    /* Activity Tab - Stack layout */
    #activityTab .dash-grid {
        grid-template-columns: 1fr !important;
        gap: var(--space-md);
    }
    
    /* Settings Tab */
    #settingsTab .dash-grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Modals - Full width on mobile */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    
    .modal-content {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: var(--space-lg) var(--space-md);
    }
    
    .modal-body {
        padding: var(--space-md);
    }
    
    .modal-footer {
        padding: var(--space-md);
        flex-direction: column;
        gap: var(--space-sm);
    }
    
    .modal-footer .btn-dash {
        width: 100%;
    }
    
    /* Touch-friendly interactions */
    .btn-dash,
    .dash-tab,
    .mobile-nav-item,
    .poem-card-dash,
    .collection-card-dash {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Safe area for bottom nav */
    .dashboard-page {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* Extra small screens */
@media (max-width: 375px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-stats {
        flex-wrap: wrap;
    }
    
    .profile-stat {
        min-width: calc(50% - var(--space-sm));
    }
    
    .dash-tab {
        padding: var(--space-sm);
        font-size: 0.8rem;
    }
    
    .mobile-nav-item {
        min-width: 48px;
        padding: 6px 8px;
        font-size: 0.65rem;
    }
    
    .mobile-nav-item svg {
        width: 20px;
        height: 20px;
    }
}

/* ============================================================================
   NOTIFICATIONS DROPDOWN - MOBILE
   ============================================================================ */
@media (max-width: 768px) {
    .notifications-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin-top: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 70vh;
        min-width: auto;
        transform: translateY(100%);
    }
    
    .notifications-dropdown.active {
        transform: translateY(0);
    }
}