/**
 * Reactive Interface Styles
 * Complete styling system for reactive dashboard components
 */

/* ================================================================
   LAYOUT FOUNDATION
   ================================================================ */

#reactive-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #0f0915;
    color: #e2e8f0;

    /* This shell paints fixed dark surfaces whatever [data-theme] says, but
       shared rules colour text through theme tokens (h1-h6 use
       --text-primary). When the theme resolves to light (e.g. an OS with
       prefers-color-scheme: light) those tokens turn near-black and headings
       vanish on the dark cards. Pin the dark values (styles.css :root) here
       so everything inside the shell stays readable. */
    --text-primary: #f9fafb;
    --text-secondary: #e2d9f3;
    --text-tertiary: #94a3b8;
    --text-muted: #a78bca;
    --text-disabled: #6b5b8a;
    --text-inverse: #0f172a;
    --bg-primary: #0d0d1a;
    --bg-secondary: #1a0d2e;
    --bg-tertiary: #0d1a2e;
    --bg-card: rgba(26, 13, 46, 0.75);
    --bg-hover: rgba(168, 85, 247, 0.10);
    --border-color: rgba(168, 85, 247, 0.20);
    --input-bg: rgba(26, 13, 46, 0.6);
}

.reactive-header {
    height: 60px;
    background: linear-gradient(90deg, rgba(26, 13, 46, 0.8) 0%, rgba(30, 41, 59, 0.6) 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 2rem;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    width: 100%;
}

.reactive-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 1rem;
    padding: 1rem;
}

.reactive-sidebar {
    width: 280px;
    background: linear-gradient(180deg, rgba(26, 13, 46, 0.8) 0%, rgba(30, 41, 59, 0.6) 100%);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    flex-shrink: 0;
}

.reactive-content {
    flex: 1;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.3) 0%, rgba(26, 13, 46, 0.3) 100%);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    overflow-y: auto;
    padding: 2rem;
}

.reactive-right-sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    flex-shrink: 0;
}

/* ================================================================
   HEADER COMPONENTS
   ================================================================ */

.logo-area {
    flex-shrink: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
    letter-spacing: -0.05em;
}

.search-area {
    flex: 1;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    color: #e2e8f0;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
}

.search-input:focus {
    outline: none;
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.header-btn {
    position: relative;
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    padding: 0.5rem;
    border-radius: 8px;
}

.header-btn:hover {
    color: #c084fc;
    background: rgba(192, 132, 252, 0.1);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    min-width: 20px;
    text-align: center;
}

.connection-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #9ca3af;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    animation: pulse 2s infinite;
}

.status-dot.disconnected {
    background: #ef4444;
    animation: none;
}

.status-dot.connecting {
    background: #f59e0b;
}

/* ================================================================
   SIDEBAR NAVIGATION
   ================================================================ */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #cbd5e1;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: 0.02em;
    position: relative;
}

.nav-item:hover {
    background: rgba(192, 132, 252, 0.1);
    color: #e2e8f0;
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.2) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-left: 3px solid #c084fc;
    padding-left: calc(1rem - 3px);
    color: #e2e8f0;
}

.unread-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: none;
}

.unread-badge:not(:empty) {
    display: block;
}

.sidebar-footer {
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    padding-top: 1rem;
    margin-top: auto;
}

.logout-btn {
    color: #ef4444;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ================================================================
   CONTENT SECTIONS
   ================================================================ */

.view-section {
    display: none;
}

.view-section.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ================================================================
   FEED SECTION
   ================================================================ */

.feed-header {
    margin-bottom: 2rem;
}

.feed-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.post-composer {
    background: var(--card-bg, rgba(30, 41, 59, 0.5)); /* theme token: was a dark-only gradient */
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.composer-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.composer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    object-fit: cover;
    flex-shrink: 0;
}

.composer-input-area {
    flex: 1;
}

.composer-textarea {
    width: 100%;
    min-height: 80px;
    background: rgba(15, 9, 21, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 1rem;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    letter-spacing: 0.01em;
}

.composer-textarea:focus {
    outline: none;
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.1);
}

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

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.composer-action-btn {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    font-size: 0.9rem;
}

.composer-action-btn:hover {
    border-color: #c084fc;
    color: #c084fc;
    background: rgba(192, 132, 252, 0.1);
}

.composer-submit-btn {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    letter-spacing: 0.02em;
}

.composer-submit-btn:hover {
    box-shadow: 0 8px 20px rgba(192, 132, 252, 0.3);
    transform: translateY(-2px);
}

.feed-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ================================================================
   MESSAGE SECTION
   ================================================================ */

.messages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.messages-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.new-message-btn {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    letter-spacing: 0.02em;
    font-size: 0.9rem;
}

/* The legacy shell section only: app.js names its Messages view's container
   "messages-container" too, and this grid put the view title in a 300px
   column beside the messenger. */
.view-section .messages-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    height: calc(100% - 60px);
}

.conversations-panel {
    background: var(--card-bg, rgba(30, 41, 59, 0.5)); /* theme token: was a dark-only gradient */
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    overflow-y: auto;
}

.conversations-list {
    padding: 1rem;
}

.messages-panel {
    background: var(--card-bg, rgba(30, 41, 59, 0.5)); /* theme token: was a dark-only gradient */
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.messages-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.message-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.message-input {
    flex: 1;
    background: rgba(15, 9, 21, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #e2e8f0;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
}

.message-input:focus {
    outline: none;
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.1);
}

.send-message-btn {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
}

.send-message-btn:hover {
    box-shadow: 0 4px 12px rgba(192, 132, 252, 0.3);
}

/* ================================================================
   NOTIFICATIONS SECTION
   ================================================================ */

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.notifications-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.clear-notifications-btn {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.1);
    color: #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    letter-spacing: 0.02em;
    font-size: 0.9rem;
}

.clear-notifications-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.notifications-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ================================================================
   PROFILE SECTION
   ================================================================ */

.profile-header {
    background: var(--card-bg, rgba(30, 41, 59, 0.5)); /* theme token: was a dark-only gradient */
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.profile-banner {
    width: 100%;
    height: 200px;
}

.profile-info {
    padding: 2rem;
    margin-top: -80px;
    position: relative;
    z-index: 10;
}

.profile-avatar-area {
    margin-bottom: 1rem;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid #0f0915;
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    object-fit: cover;
}

.profile-details {
    background: rgba(15, 9, 21, 0.5);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    letter-spacing: -0.02em;
}

.profile-bio {
    color: #cbd5e1;
    margin: 0 0 1.5rem 0;
    letter-spacing: 0.01em;
}

.profile-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.85rem;
    color: #9ca3af;
    margin-top: 0.25rem;
    letter-spacing: 0.01em;
}

.profile-actions {
    display: flex;
    gap: 1rem;
}

.profile-action-btn {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
    letter-spacing: 0.02em;
}

.profile-action-btn:hover {
    box-shadow: 0 8px 20px rgba(192, 132, 252, 0.3);
    transform: translateY(-2px);
}

.profile-posts {
    background: var(--card-bg, rgba(30, 41, 59, 0.5)); /* theme token: was a dark-only gradient */
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.profile-posts h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

/* ================================================================
   SETTINGS SECTION
   ================================================================ */

.settings-header {
    margin-bottom: 2rem;
}

.settings-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.settings-section {
    background: var(--card-bg, rgba(30, 41, 59, 0.5)); /* theme token: was a dark-only gradient */
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.settings-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.settings-item {
    margin-bottom: 1rem;
}

.settings-item label {
    display: block;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.settings-input {
    width: 100%;
    background: rgba(15, 9, 21, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #e2e8f0;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1); transition-property: var(--transition-safe);
}

.settings-input:focus {
    outline: none;
    border-color: #c084fc;
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: #cbd5e1;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ================================================================
   RIGHT SIDEBAR
   ================================================================ */

.sidebar-widget {
    background: var(--card-bg, rgba(30, 41, 59, 0.5)); /* theme token: was a dark-only gradient */
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.sidebar-widget h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    letter-spacing: 0.02em;
}

.trending-items,
.suggestions-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ================================================================
   EMPTY STATES
   ================================================================ */

.empty-state-content {
    text-align: center;
    padding: 3rem 1rem;
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.empty-state-text {
    font-size: 1rem;
    letter-spacing: 0.01em;
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */

@media (max-width: 1400px) {
    .reactive-right-sidebar {
        width: 280px;
    }
}

@media (max-width: 1200px) {
    .reactive-right-sidebar {
        display: none;
    }

    .reactive-content {
        max-width: 800px;
        margin: 0 auto;
    }
}

@media (max-width: 992px) {
    .reactive-sidebar {
        width: 240px;
        padding: 1rem;
    }

    .reactive-content {
        padding: 1.5rem;
    }

    .view-section .messages-container {
        grid-template-columns: 250px 1fr;
    }
}

@media (max-width: 768px) {
    .reactive-main {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .reactive-sidebar {
        width: 100%;
        border-radius: 0;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border: none;
        border-bottom: 1px solid rgba(148, 163, 184, 0.1);
        padding: 0.5rem 1rem;
        gap: 0;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        flex: 1;
    }

    .nav-item {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .sidebar-footer {
        border: none;
        padding: 0;
        margin: 0;
        margin-left: auto;
    }

    .reactive-content {
        border-radius: 0;
        padding: 1rem;
        max-width: 100%;
    }

    .view-section .messages-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .conversations-panel {
        display: none;
    }

    .search-area {
        max-width: 200px;
    }

    .profile-stats {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .reactive-header {
        padding: 0 1rem;
        gap: 1rem;
    }

    /* Phone nav: seven labelled items cannot fit in one row (the row was
       clipped mid-"Notifications" with its badge cut off). Show icons only,
       spread across the full width, and keep each label for screen readers.
       Unread badges sit on the icon's corner instead of trailing the label. */
    .reactive-sidebar {
        padding: 0.25rem 0.5rem;
        overflow-x: hidden;
    }

    .reactive-sidebar .sidebar-nav {
        gap: 0;
        justify-content: space-between;
    }

    .reactive-sidebar .nav-item {
        position: relative;
        flex: 1 1 0;
        min-width: 44px;
        min-height: 44px;
        justify-content: center;
        padding: 0.5rem 0;
        gap: 0;
    }

    .reactive-sidebar .nav-item.active {
        border-left: none;
        box-shadow: inset 0 -2px 0 #c084fc;
        padding-left: 0;
    }

    .reactive-sidebar .nav-item > span:not(.unread-badge) {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }

    .reactive-sidebar .nav-item .unread-badge {
        position: absolute;
        top: 2px;
        left: calc(50% + 4px);
        margin: 0;
        padding: 0 4px;
        font-size: 0.6rem;
        line-height: 1.4;
    }

    .reactive-sidebar .sidebar-footer {
        flex: 0 0 auto;
        margin-left: 0;
    }

    .logo {
        font-size: 1.2rem;
    }

    .search-area {
        display: none;
    }

    .header-actions {
        gap: 1rem;
    }

    .reactive-content {
        padding: 0.75rem;
    }

    .post-composer {
        padding: 1rem;
    }

    .composer-header {
        gap: 0.75rem;
    }

    .profile-info {
        padding: 1rem;
    }

    .profile-avatar-large {
        width: 80px;
        height: 80px;
    }

    .profile-name {
        font-size: 1.2rem;
    }

    .profile-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* ================================================================
   ANIMATIONS & TRANSITIONS
   ================================================================ */



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

/* ================================================================
   ACCESSIBILITY
   ================================================================ */

button:focus {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

input:focus {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}
