/* Global Reset & Variables */
:root {
    --bg-main: #050505;
    --bg-secondary: #0f0f11;
    --bg-card: rgba(20, 20, 23, 0.4);
    --bg-glass: rgba(10, 10, 12, 0.9);

    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;

    /* Pivotly Orange Theme Restored */
    --accent-blue: #FF6D00;
    /* Main Orange */
    --accent-blue-hover: #FF9100;

    --accent-green: #00E676;
    --accent-red: #FF1744;

    --border-subtle: rgba(255, 255, 255, 0.08);

    --surface-hover: rgba(255, 255, 255, 0.05);
    --surface-card: var(--bg-card);

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Force Hidden - High Priority */
.hidden,
.view-hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

body {
    background-color: var(--bg-main);
    background-image:
        radial-gradient(circle at 50% 0%, rgba(255, 109, 0, 0.05) 0%, transparent 60%);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    /* min-height: 100vh removed - was causing layout issues */
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
}

/* ... existing styles ... */

/* Main container */
main {
    /* flex: 1 removed - was causing vertical expansion */
}

/* Footer & Legal */
footer {
    /* Removed border and background for cleaner look */
    border-top: none;
    padding: 30px 0;
    margin-top: auto;
    /* Push footer to bottom in flex layout */
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: transparent;
    opacity: 0.7;
    /* User requested "less transparency" likely meaning "more subtle" or just "less visible" */
}

/* Subtle Grid Pattern */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: -1;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    letter-spacing: -0.5px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    outline: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-social {
    width: 100%;
    background: #18181b;
    color: white;
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    display: flex;
    gap: 12px;
}

.btn-social:hover {
    background: #27272a;
    border-color: var(--text-secondary);
}

/* Header & Nav */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    /* Removed backdrop-filter for performance */
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 0;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    /* Optional: Ensure it doesn't shrink */
    flex-shrink: 0;
}

.nav-tabs {
    display: flex;
    gap: 30px;
}

.nav-tab {
    position: relative;
    padding: 8px 0;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
}

.nav-tab.active {
    color: var(--text-primary);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    /* Align exactly at bottom of element */
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-blue);
    border-radius: 2px 2px 0 0;
    box-shadow: 0 0 10px var(--accent-blue);
    /* Glow effect to make it pop */
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Views */
.view-section {
    padding-top: 20px;
    padding-bottom: 40px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    animation: fadeIn 0.5s forwards;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue-hover);
}

/* Animations & Utils */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Start View - vertically centered landing page */
#start-view:not(.hidden) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    text-align: center;
}

/* Hero Section */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 100px 20px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    line-height: 1.1;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 40px;
}

/* Analysis Grid */
.feeds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.card:hover {
    border-color: var(--text-secondary);
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: #1a1a1a;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.card:hover .card-image {
    opacity: 1;
}

.card-content {
    padding: 20px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.card-title {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card-excerpt {
    font-size: 0.95rem;
    color: #ccc;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.tag {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 15px;
    margin-top: 10px;
}

.price-tag {
    font-weight: 600;
    color: var(--accent-green);
}

.likes-count {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color 0.2s;
}

.likes-count:hover {
    color: var(--accent-red);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    /* Opaque background instead of blur */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    /* Faster transition */
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
    display: flex !important;
    /* Force visibility */
}

.modal {
    background: #161616;
    width: 90%;
    max-width: 600px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    padding: 30px;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.open .modal {
    transform: scale(1);
    opacity: 1;
    /* Ensure visibility */
}

/* Carousel */
#carousel-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    /* Default aspect ratio */
    background: #000;
}

#carousel-images {
    display: flex;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    object-fit: contain;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.carousel-dot.active {
    background: var(--accent-blue);
    transform: scale(1.2);
}

.modal-header {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 0;
    /* Reset padding from any inline overrides */
}

.close-modal {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px;
    background: #0a0a0a;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--accent-blue);
    outline: none;
}

.level-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* File Upload */
.file-drop-area {
    border: 2px dashed var(--border-subtle);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-drop-area:hover {
    border-color: var(--accent-blue);
}
}

/* Header Profile & Avatar */
.header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 20px;
    transition: background 0.2s;
    /* Force row layout */
    flex-direction: row !important;
}

.header-profile:hover {
    background: rgba(255, 255, 255, 0.05);
}

.avatar-small {
    width: 32px;
    height: 32px;
    min-width: 32px;
    /* Prevent shrinking */
    background: var(--accent-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1;
}

/* Footer & Legal */
footer {
    border-top: none;
    padding: 30px 0;
    margin-top: auto;
    /* Push to bottom */
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: transparent;
    opacity: 0.7;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 0;
    /* Spacing handled by padding for separators */
    margin-bottom: 25px;
    align-items: center;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0 15px;
    /* Side padding */
    position: relative;
    transition: color 0.2s;
}

/* Separator Dot */
.footer-links a:not(:last-child)::after {
    content: '·';
    position: absolute;
    right: 0;
    color: rgba(255, 255, 255, 0.2);
    font-weight: bold;
    pointer-events: none;
}

.footer-links a:hover {
    color: var(--accent-blue);
    /* Color popup only, no background */
    text-decoration: none;
    background: transparent;
}

/* Legal Styles */
#legal-view {
    padding-top: 0 !important;
    margin-top: -110px !important;
    /* Pull content up to eliminate space */
    min-height: auto !important;
}

#legal-view .legal-content {
    padding-top: 20px !important;
}

.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding-top: 20px;
    padding-bottom: 60px;
}

.legal-box {
    background: rgba(255, 255, 255, 0.05);
    /* Slightly more visible */
    padding: 50px;
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 30px;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.legal-box:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

/* Risk Box Specifics */
.legal-box.risk-box {
    background: linear-gradient(135deg, rgba(255, 23, 68, 0.1) 0%, rgba(20, 20, 20, 0.5) 100%);
    border: 1px solid rgba(255, 23, 68, 0.3);
    border-left: 4px solid var(--accent-red);
}

.legal-box h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 15px;
    letter-spacing: -0.5px;
}

.legal-box h3 {
    font-size: 1.1rem;
    margin-top: 35px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 600;
}

.legal-box p,
.legal-box ul {
    margin-bottom: 15px;
}

/* --- Dashboard Tabs (Segmented Control) --- */
.dashboard-tabs {
    display: flex;
    /* REMOVED: background, border-radius, padding, margin, border, max-width */
    /* These are now handled by inline styles in HTML */
}

.dashboard-tab {
    /* REMOVED: flex: 1 - this was causing the ghost space */
    text-align: center;
    padding: 8px 12px;
    border-radius: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    /* Prevent wrapping */
}

.dashboard-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-tab.active {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* --- My Circles Grid (Cards) --- */
.dashboard-circles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.circle-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    transition: transform 0.2s, border-color 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.circle-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.circle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.circle-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.circle-card-tag {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.circle-role-badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 700;
}

.circle-role-owner {
    background: rgba(255, 193, 7, 0.15);
    color: #FFC107;
}

.circle-role-member {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
}

.circle-card-stats {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-subtle);
}

/* Discord Style Tweaks */
.circle-layout {
    grid-template-columns: 1fr 240px;
    /* Reduced sidebar width */
    background: var(--bg-secondary);
    /* Darker playground */
    padding: 0;
    max-width: 100%;
    height: calc(100vh - 80px);
    /* Fill screen minus header */
}

.circle-chat-area {
    border: none;
    border-radius: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
}

.circle-sidebar {
    background: #0b0b0d;
    /* Very dark for member list */
    border-left: 1px solid var(--border-subtle);
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-right: none;
    padding: 20px 15px;
}

.circle-header {
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    height: 60px;
    padding: 0 20px;
}

/* Chat Input Pinning */
.chat-controls {
    background: transparent;
    padding: 0 20px 25px 20px;
    border-top: none;
    margin-top: auto;
    /* Push to bottom */
}

/* Input Styling like Discord */
.chat-input {
    background: rgba(255, 255, 255, 0.07);
    border: none;
    padding: 15px;
    color: white;
    font-size: 0.95rem;
}

.chat-input:focus {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}


/* --- Refined Circle Detail --- */

/* Fix Layout */
.circle-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    /* Force sidebar width */
    grid-template-areas: 'chat sidebar';
    width: 100%;
    max-width: 100%;
}

.circle-chat-area {
    grid-area: chat;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    /* Prevent overflow */
}

.circle-sidebar {
    grid-area: sidebar;
    background: #0b0b0d;
    border-left: 1px solid var(--border-subtle);
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

/* Chat Input Bottom Pin Fix */
.chat-controls {
    margin-top: auto;
    /* Push to bottom */
    width: 100%;
    /* Ensure it hits the bottom visually */
    border-top: 1px solid transparent;
}

.chat-input {
    border-radius: 4px;
    /* Less rounded */
}

/* Sidebar Styling */
.sidebar-header {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

/* Dashboard Grid Fix */
#dashboard-posts-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 25px !important;
    margin-top: 20px;
}

/* Circle Feed Grid Fix */
#circle-feed-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 25px !important;
}

/* Feeds Header Fix */
.feeds-header {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

/* Discover Posts Grid Fix */
#posts-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 25px !important;
}

/* Liked Heart Style */
.likes-count.liked {
    color: #ff4757 !important;
}

.likes-count.liked span:first-child {
    color: #ff4757 !important;
}

/* --- Updates for v24 --- */

.nav-left {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-logo {
    height: 48px !important;
    /* Force bigger size */
    width: auto;
    object-fit: contain;
}

.text-gradient-pivotly {
    font-size: 5rem;
    font-weight: 800;
    letter-spacing: -2px;
    /* Gradient: White -> Yellow -> Orange */
    background: linear-gradient(135deg, #ffffff 10%, #FFD700 50%, #FF6D00 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 30px;
    /* Increased margin */
    display: inline-block;
    filter: drop-shadow(0 0 30px rgba(255, 109, 0, 0.25));
    line-height: 1.1;
    padding: 10px;
    /* Prevent chop */
}

/* Explicit Hero Styles to fix overlap and width */
.hero-title {
    font-size: 4rem;
    /* Match Pivotly size roughly or slightly smaller */
    line-height: 1.2;
    margin-bottom: 30px;
    font-weight: 700;
    margin-top: 10px;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    max-width: 800px;
    /* Wider to prevent early wrapping */
    margin: 0 auto 50px auto;
    /* Center with margin bottom */
    line-height: 1.6;

}

/* Dashboard Tabs Alignment Fix */
.dashboard-tabs {
    display: flex;
    justify-content: flex-start !important;
    gap: 15px;
    margin-bottom: 30px;
}

/* My Circles Grid Fix */
.dashboard-circles-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
    gap: 25px !important;
    width: 100%;
}