/* Room2Exchange Public CSS - Dashboard and General Styles */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables - Modern Flat Design */
:root {
    --r2e-primary: #4F46E5;
    --r2e-primary-dark: #4338CA;
    --r2e-primary-light: #6366F1;
    --r2e-secondary: #6B7280;
    --r2e-success: #10b981;
    --r2e-error: #ef4444;
    --r2e-warning: #f59e0b;
    --r2e-info: #06b6d4;
    --r2e-background: #ffffff;
    --r2e-surface: #F9FAFB;
    --r2e-surface-dark: #F3F4F6;
    --r2e-border: #E5E7EB;
    --r2e-border-light: #F3F4F6;
    --r2e-text: #111827;
    --r2e-text-light: #6B7280;
    --r2e-text-muted: #9CA3AF;
    --r2e-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --r2e-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --r2e-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    --r2e-radius: 8px;
    --r2e-radius-lg: 12px;
    --r2e-radius-xl: 16px;
}

/* Modern Icon System */
.r2e-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    fill: currentColor;
    flex-shrink: 0;
    font-size: 20px;
}

.r2e-icon-lg {
    width: 24px;
    height: 24px;
    font-size: 24px;
}

.r2e-icon-xl {
    width: 32px;
    height: 32px;
    font-size: 32px;
}

/* Font Awesome Integration */
.fas, .far, .fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Base styles */
.r2e-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Dashboard Layout */
.r2e-dashboard {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
    min-height: 100vh;
    background: var(--r2e-surface);
}

.r2e-sidebar {
    background: var(--r2e-background);
    border-right: 1px solid var(--r2e-border);
    padding: 2rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.r2e-main-content {
    padding: 2rem 2rem 2rem 0;
}

/* Sidebar Navigation */
.r2e-nav {
    padding: 0 1rem;
}

.r2e-nav-header {
    padding: 0 1rem 1rem 1rem;
    border-bottom: 1px solid var(--r2e-border);
    margin-bottom: 1rem;
}

.r2e-nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--r2e-text);
    margin: 0;
}

.r2e-nav-subtitle {
    font-size: 0.875rem;
    color: var(--r2e-text-light);
    margin: 0.25rem 0 0 0;
}

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

.r2e-nav-item {
    margin-bottom: 0.25rem;
}

.r2e-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--r2e-text-light);
    text-decoration: none;
    border-radius: var(--r2e-radius);
    transition: all 0.2s ease;
    font-weight: 500;
}

.r2e-nav-link:hover {
    background: var(--r2e-surface);
    color: var(--r2e-primary);
}

.r2e-nav-link.active {
    background: var(--r2e-primary);
    color: white;
}

.r2e-nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

/* Dashboard Header */
.r2e-dashboard-header {
    background: var(--r2e-background);
    border-radius: var(--r2e-radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--r2e-shadow);
}

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

.r2e-header-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--r2e-text);
    margin: 0 0 0.5rem 0;
}

.r2e-header-subtitle {
    color: var(--r2e-text-light);
    margin: 0;
    font-size: 1.125rem;
}

.r2e-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Stats Cards */
.r2e-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.r2e-stat-card {
    background: var(--r2e-background);
    border-radius: var(--r2e-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--r2e-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

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

.r2e-stat-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--r2e-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.r2e-stat-icon {
    width: 24px;
    height: 24px;
    color: var(--r2e-primary);
}

.r2e-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--r2e-text);
    margin: 0;
    line-height: 1;
}

.r2e-stat-change {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.r2e-stat-change.positive {
    color: var(--r2e-success);
}

.r2e-stat-change.negative {
    color: var(--r2e-error);
}

/* Content Cards */
.r2e-card {
    background: var(--r2e-background);
    border-radius: var(--r2e-radius-lg);
    box-shadow: var(--r2e-shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

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

.r2e-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--r2e-text);
    margin: 0;
}

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

.r2e-card-content {
    padding: 2rem;
}

.r2e-card-footer {
    padding: 1rem 2rem;
    background: var(--r2e-surface);
    border-top: 1px solid var(--r2e-border);
}

/* Match Cards */
.r2e-matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.r2e-match-card {
    background: var(--r2e-background);
    border-radius: var(--r2e-radius-lg);
    box-shadow: var(--r2e-shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.r2e-match-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--r2e-border);
}

.r2e-match-score {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--r2e-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.r2e-match-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--r2e-text);
    margin: 0 0 0.5rem 0;
}

.r2e-match-location {
    color: var(--r2e-text-light);
    font-size: 0.875rem;
    margin: 0;
}

.r2e-match-content {
    padding: 1.5rem;
}

.r2e-match-reasons {
    margin-bottom: 1.5rem;
}

.r2e-match-reasons-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--r2e-text);
    margin: 0 0 0.75rem 0;
}

.r2e-match-reasons-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.r2e-match-reason {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--r2e-text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.r2e-match-reason::before {
    content: '✓';
    color: var(--r2e-success);
    font-weight: 600;
}

.r2e-match-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.r2e-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--r2e-radius);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.r2e-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.r2e-btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.r2e-btn-primary {
    background: var(--r2e-primary);
    color: white;
}

.r2e-btn-primary:hover {
    background: var(--r2e-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--r2e-shadow-md);
}

.r2e-btn-secondary {
    background: var(--r2e-surface);
    color: var(--r2e-text);
    border: 1px solid var(--r2e-border);
}

.r2e-btn-secondary:hover {
    background: var(--r2e-background);
    border-color: var(--r2e-primary);
    color: var(--r2e-primary);
}

.r2e-btn-success {
    background: var(--r2e-success);
    color: white;
}

.r2e-btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--r2e-shadow-md);
}

.r2e-btn-danger {
    background: var(--r2e-error);
    color: white;
}

.r2e-btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--r2e-shadow-md);
}

.r2e-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Messages */
.r2e-messages-container {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.r2e-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--r2e-surface);
    border-radius: var(--r2e-radius);
    margin-bottom: 1rem;
}

.r2e-message {
    display: flex;
    margin-bottom: 1rem;
}

.r2e-message.own {
    justify-content: flex-end;
}

.r2e-message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: var(--r2e-radius-lg);
    background: var(--r2e-background);
    box-shadow: var(--r2e-shadow);
}

.r2e-message.own .r2e-message-bubble {
    background: var(--r2e-primary);
    color: white;
}

.r2e-message-content {
    margin: 0;
    line-height: 1.5;
}

.r2e-message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

.r2e-message-form {
    display: flex;
    gap: 0.75rem;
}

.r2e-message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--r2e-border);
    border-radius: var(--r2e-radius);
    font-family: inherit;
}

/* Notifications */
.r2e-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--r2e-background);
    border-radius: var(--r2e-radius-lg);
    box-shadow: var(--r2e-shadow-lg);
    padding: 1rem 1.5rem;
    max-width: 400px;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.r2e-notification.show {
    transform: translateX(0);
}

.r2e-notification.success {
    border-left: 4px solid var(--r2e-success);
}

.r2e-notification.error {
    border-left: 4px solid var(--r2e-error);
}

.r2e-notification.warning {
    border-left: 4px solid var(--r2e-warning);
}

.r2e-notification.info {
    border-left: 4px solid var(--r2e-info);
}

/* Tables */
.r2e-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--r2e-background);
    border-radius: var(--r2e-radius-lg);
    overflow: hidden;
    box-shadow: var(--r2e-shadow);
}

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

.r2e-table th {
    background: var(--r2e-surface);
    font-weight: 600;
    color: var(--r2e-text);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.r2e-table tr:hover {
    background: var(--r2e-surface);
}

/* Badges */
.r2e-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.r2e-badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--r2e-primary);
}

.r2e-badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--r2e-success);
}

.r2e-badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--r2e-warning);
}

.r2e-badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--r2e-error);
}

.r2e-badge-secondary {
    background: rgba(100, 116, 139, 0.1);
    color: var(--r2e-secondary);
}

/* Loading States */
.r2e-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.r2e-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--r2e-border);
    border-top: 3px solid var(--r2e-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty States */
.r2e-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--r2e-text-light);
}

.r2e-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem auto;
    opacity: 0.5;
}

.r2e-empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.r2e-empty-description {
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .r2e-dashboard {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .r2e-sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--r2e-border);
        padding: 1rem 0;
    }
    
    .r2e-nav {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0 1rem;
    }
    
    .r2e-nav-list {
        display: flex;
        gap: 0.5rem;
        white-space: nowrap;
    }
    
    .r2e-nav-item {
        margin-bottom: 0;
    }
    
    .r2e-main-content {
        padding: 2rem 1rem;
    }
}

@media (max-width: 768px) {
    .r2e-container {
        padding: 0 0.5rem;
    }
    
    .r2e-dashboard-header {
        padding: 1.5rem;
    }
    
    .r2e-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .r2e-header-title {
        font-size: 1.5rem;
    }
    
    .r2e-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .r2e-matches-grid {
        grid-template-columns: 1fr;
    }
    
    .r2e-card-content {
        padding: 1.5rem;
    }
    
    .r2e-match-actions {
        flex-direction: column;
    }
    
    .r2e-btn {
        width: 100%;
        justify-content: center;
    }
    
    .r2e-notification {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

/* Utility Classes */
.r2e-text-center { text-align: center; }
.r2e-text-left { text-align: left; }
.r2e-text-right { text-align: right; }

.r2e-font-bold { font-weight: 700; }
.r2e-font-semibold { font-weight: 600; }
.r2e-font-medium { font-weight: 500; }

.r2e-text-sm { font-size: 0.875rem; }
.r2e-text-lg { font-size: 1.125rem; }
.r2e-text-xl { font-size: 1.25rem; }

.r2e-mb-0 { margin-bottom: 0; }
.r2e-mb-1 { margin-bottom: 0.5rem; }
.r2e-mb-2 { margin-bottom: 1rem; }
.r2e-mb-3 { margin-bottom: 1.5rem; }
.r2e-mb-4 { margin-bottom: 2rem; }

.r2e-mt-0 { margin-top: 0; }
.r2e-mt-1 { margin-top: 0.5rem; }
.r2e-mt-2 { margin-top: 1rem; }
.r2e-mt-3 { margin-top: 1.5rem; }
.r2e-mt-4 { margin-top: 2rem; }

.r2e-hidden { display: none; }
.r2e-visible { display: block; }

.r2e-flex { display: flex; }
.r2e-flex-col { flex-direction: column; }
.r2e-items-center { align-items: center; }
.r2e-justify-center { justify-content: center; }
.r2e-justify-between { justify-content: space-between; }

.r2e-w-full { width: 100%; }
.r2e-h-full { height: 100%; }

.r2e-rounded { border-radius: var(--r2e-radius); }
.r2e-rounded-lg { border-radius: var(--r2e-radius-lg); }
.r2e-rounded-xl { border-radius: var(--r2e-radius-xl); }

.r2e-shadow { box-shadow: var(--r2e-shadow); }
.r2e-shadow-md { box-shadow: var(--r2e-shadow-md); }
.r2e-shadow-lg { box-shadow: var(--r2e-shadow-lg); }

/* Conversation Styles */
.r2e-conversations {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.r2e-conversation-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--r2e-border);
    border-radius: var(--r2e-border-radius);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.r2e-conversation-item:hover {
    border-color: var(--r2e-primary);
    background: var(--r2e-bg-light);
}

.r2e-conversation-avatar {
    flex-shrink: 0;
}

.r2e-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--r2e-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
}

.r2e-conversation-content {
    flex: 1;
    min-width: 0;
}

.r2e-conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.r2e-conversation-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--r2e-text);
}

.r2e-conversation-time {
    font-size: 0.75rem;
    color: var(--r2e-text-light);
    white-space: nowrap;
}

.r2e-conversation-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.r2e-last-message {
    font-size: 0.875rem;
    color: var(--r2e-text-light);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.r2e-unread-badge {
    background: var(--r2e-primary);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* AgencyAnalytics-inspired theme overrides */
:root {
    --aa-sidebar-bg: #0f172a; /* slate-900 */
    --aa-sidebar-border: #0b1220;
    --aa-sidebar-text: #cbd5e1; /* slate-300 */
    --aa-sidebar-text-muted: #94a3b8; /* slate-400 */
    --aa-sidebar-active: #1e293b; /* slate-800 */
    --aa-accent: #2563eb; /* indigo-600 */
    --aa-accent-700: #1d4ed8; /* indigo-700 */
}

/* Layout background closer to AA */
.r2e-dashboard {
    background: #f3f6fb;
}

/* Dark sidebar styling */
.r2e-sidebar {
    background: var(--aa-sidebar-bg);
    border-right: 1px solid var(--aa-sidebar-border);
}

.r2e-nav-header {
    border-color: rgba(148, 163, 184, 0.12);
}

.r2e-nav-title {
    color: #e2e8f0;
}

.r2e-nav-subtitle {
    color: var(--aa-sidebar-text-muted);
}

/* Sidebar links */
.r2e-nav-link {
    color: var(--aa-sidebar-text);
}

.r2e-nav-link:hover {
    background: rgba(148, 163, 184, 0.08);
    color: #e2e8f0;
}

.r2e-nav-link.active {
    background: var(--aa-sidebar-active);
    color: #e2e8f0;
    box-shadow: inset 3px 0 0 0 var(--aa-accent);
}

/* Icons in sidebar */
.r2e-sidebar .r2e-nav-icon {
    color: var(--aa-sidebar-text-muted);
}

/* Header card more AA-like */
.r2e-dashboard-header {
    border: 1px solid var(--r2e-border);
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

/* Cards subtler shadow and border */
.r2e-card {
    border: 1px solid var(--r2e-border);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

/* Primary buttons closer to AA */
.r2e-btn-primary {
    background: var(--aa-accent);
}

.r2e-btn-primary:hover {
    background: var(--aa-accent-700);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

/* Secondary buttons */
.r2e-btn-secondary:hover {
    border-color: var(--aa-accent);
    color: var(--aa-accent);
}

/* Stat cards: thin border and subtle header color */
.r2e-stat-card {
    border: 1px solid var(--r2e-border);
}

.r2e-stat-title {
    color: #6b7280;
}

/* Tables hover color slightly stronger */
.r2e-table tr:hover {
    background: #f9fbff;
}

/* Badges */
.r2e-badge-primary {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}
