
/* index.css */

@import url('index/foryou.css');
@import url('index/legislative.css');
@import url('index/chat.css');
@import url('index/auth.css');

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

:root {
    --primary: #1e3a8a;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --accent: #0ea5e9;
    --accent-light: #38bdf8;
    --blue: #0284c7;
    --blue-light: #e0f2fe;
    --blue-dark: #075985;
    --bg-light: #f8fafc;
    --bg-cream: #fef9e7;
    --bg-white: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(15, 23, 42, 0.08);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 0.95rem;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.active {
    background: rgba(255,255,255,0.15);
    color: white;
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.btn-icon-notif {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
}

.btn-icon-notif:hover {
    background: rgba(255,255,255,0.2);
}

.btn-icon-notif svg {
    display: block;
}

/* Utilities */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

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

/* Responsive */
@media (max-width: 1200px) {
    .feed-layout {
        grid-template-columns: 1fr;
    }
    .communities-sidebar, .feed-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    .header-container {
        padding: 0 1rem;
    }
    .nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .stance-selector {
        grid-template-columns: 1fr;
    }
}


/* ===== MOBILE NAVIGATION ===== */
.mobile-menu-toggle {
    display: none;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-menu-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.mobile-menu-toggle svg {
    display: block;
}

/* Default nav-links styles for DESKTOP */
.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* ===== FLOATING ACTION BUTTON ===== */
.fab-create-post {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
    cursor: pointer;
    z-index: 999;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.fab-create-post:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.5);
}

.fab-create-post:active {
    transform: scale(0.95);
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Intermediate sizing for medium screens */
@media (max-width: 1200px) {
    .nav-links {
        gap: 1rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .btn-primary {
        padding: 0.55rem 1rem;
        font-size: 0.9rem;
    }
}

/* Show hamburger menu at 1100px instead of 968px */
@media (max-width: 1100px) {
    /* Show hamburger menu */
    .mobile-menu-toggle {
        display: flex;
        order: 2;
    }
    
    /* Transform nav-links into mobile sidebar */
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 70px);
        background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.5rem;
        transition: left 0.3s ease;
        z-index: 999;
        overflow-y: auto;
        box-shadow: 2px 0 12px rgba(0,0,0,0.2);
    }
    
    .nav-links.active {
        left: 0;
    }
    
    /* Style nav links for mobile sidebar */
    .nav-links .nav-link {
        width: 100%;
        text-align: left;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .nav-links .btn-primary,
    .nav-links .btn-icon-header {
        width: 100%;
        justify-content: center;
    }
    
    /* Reorder header */
    .header-container {
        padding: 1rem;
    }
    
    .logo {
        order: 1;
        flex: 1;
    }
    
    .nav {
        order: 3;
        width: auto;
        gap: 0.5rem;
    }
    
    /* Show floating action button on mobile */
    .fab-create-post {
        display: flex;
    }
}

@media (max-width: 768px) {
    /* Container adjustments */
    .container {
        padding: 1rem;
    }
    
    /* FAB positioning adjustment */
    .fab-create-post {
        bottom: 1.5rem;
        right: 1.5rem;
    }
    
    /* Feed layout */
    .feed-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .communities-sidebar,
    .feed-sidebar {
        display: none;
    }
    
    /* Feed header adjustments */
    .feed-header {
        padding: 1.25rem;
    }
    
    .feed-header h1 {
        font-size: 1.5rem !important;
    }
    
    .feed-header p {
        font-size: 0.9rem !important;
    }
    
    /* Filter chips */
    .filter-row {
        gap: 0.375rem;
    }
    
    .chip {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Cards */
    .post-card,
    .bill-card,
    .legislator-card,
    .research-card {
        padding: 1rem;
        border-left-width: 3px;
    }
    
    .post-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .post-vote {
        order: -1;
        flex-direction: row;
        padding: 0.375rem 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .post-title {
        font-size: 1rem;
    }
    
    .post-content {
        font-size: 0.9rem;
    }
    
    /* Intelligence grid */
    .intelligence-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .intel-card {
        padding: 1rem;
    }
    
    .intel-number {
        font-size: 2rem;
    }
    
    /* Search section */
    .search-section {
        padding: 1rem;
    }
    
    .search-input {
        padding: 0.75rem 1rem 0.75rem 2.5rem;
        font-size: 0.9rem;
    }
    
    /* CHAT MODAL MOBILE FIXES */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 95vh;
    }
    
    /* Chat modal specific adjustments */
    #chatModal .modal-content {
        padding: 0;
        height: 90vh;
        max-height: 90vh;
    }
    
    #chatModal .modal-header {
        padding: 1rem;
        border-bottom: 2px solid var(--border);
    }
    
    #chatModal .modal-header h2 {
        font-size: 1.25rem;
    }
    
    #chatModal .close-modal {
        top: 1rem;
        right: 1rem;
    }
    
    /* Chat layout - stack on mobile */
    #chatModal > .modal-content > div[style*="display: flex"] {
        flex-direction: column !important;
    }
    
    #conversationsList {
        width: 100% !important;
        max-height: 200px !important;
        border-right: none !important;
        border-bottom: 2px solid var(--border) !important;
    }
    
    #activeChat {
        flex: 1 !important;
    }
    
    /* Chat messages */
    .message-bubble {
        max-width: 85%;
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
    
    .chat-message {
        margin-bottom: 1rem;
    }
    
    #chatMessages {
        padding: 1rem !important;
    }
    
    #chatInput {
        padding: 0.75rem !important;
    }
    
    #chatInput form {
        flex-direction: column !important;
    }
    
    #chatMessageInput {
        min-height: 60px !important;
    }
    
    #chatInput .btn {
        height: auto !important;
        padding: 0.75rem 1.5rem !important;
    }
    
    /* Conversation items */
    .conversation-item {
        padding: 0.75rem;
    }
    
    .conversation-preview {
        font-size: 0.8rem;
    }
    
    .chat-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    /* General modal adjustments */
    .modal-content {
        width: 100%;
        max-width: 100%;
        padding: 1.5rem;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .modal-header h2 {
        font-size: 1.4rem;
    }
    
    .close-modal {
        top: 1rem;
        right: 1rem;
        width: 28px;
        height: 28px;
        font-size: 1.25rem;
    }
    
    /* Forms */
    .stance-selector {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stance-option {
        padding: 1rem;
    }
    
    /* Form inputs */
    .form-input,
    .form-textarea,
    .form-select {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    .form-textarea {
        min-height: 100px;
    }
    
    /* Buttons - stack */
    .modal-content form > div[style*="display: flex"] {
        flex-direction: column !important;
    }
    
    .btn {
        width: 100%;
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }
    
    /* Bill tabs */
    .bill-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 0;
    }
    
    .bill-tab {
        padding: 0.625rem 1rem;
        white-space: nowrap;
        font-size: 0.85rem;
    }
    
    /* FAB smaller on very small screens */
    .fab-create-post {
        width: 52px;
        height: 52px;
        bottom: 1rem;
        right: 1rem;
    }
    
    /* Hide conversations list, add toggle button */
    #conversationsList {
        display: none;
    }
    
    #conversationsList.show-mobile {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        z-index: 10;
    }
    
    /* Chat header adjustments */
    #chatHeader {
        display: flex;
        align-items: center;
        gap: 0.75rem;
    }
    
    .chat-back-btn {
        background: var(--bg-light);
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: 0.5rem;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Opinion bar */
    .opinion-bar {
        height: 32px;
    }
    
    .opinion-segment {
        font-size: 0.75rem;
    }
    
    /* Poll options */
    .poll-option-content {
        padding: 0.625rem 0.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    /* Post footer */
    .post-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    /* Comments */
    .comment {
        padding: 0.75rem;
    }
    
    .comment-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    /* Bill detail */
    .bill-detail {
        padding: 1.25rem;
    }
    
    .bill-detail h1 {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 375px) {
    .fab-create-post {
        width: 48px;
        height: 48px;
    }
    
    .fab-create-post svg {
        width: 20px;
        height: 20px;
    }
}

/* Touch-friendly adjustments */
@media (hover: none) and (pointer: coarse) {
    .nav-links .nav-link {
        padding: 0.75rem 1rem;
    }
    
    .chip {
        padding: 0.5rem 0.875rem;
    }
    
    .vote-btn {
        padding: 0.5rem 0.75rem;
    }
    
    .btn {
        padding: 0.875rem 1.25rem;
    }
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
}