/* ===== Variáveis e reset ===== */
:root, [data-theme="dark"] {
    --bg-dark: #0d0d0d;
    --bg-card: #1a1a1a;
    --bg-card-hover: #252525;
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.85);
    --accent-teal: #2dd4bf;
    --accent-red: #ef4444;
    --accent-blue: #38bdf8;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --hex-size: 24px;
}
[data-theme="light"] {
    --bg-dark: #e5e7eb;
    --bg-card: #ffffff;
    --bg-card-hover: #f3f4f6;
    --text-primary: #111827;
    --text-muted: rgba(17, 24, 39, 0.75);
    --border-subtle: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] body {
    background-color: var(--bg-dark);
}
[data-theme="light"] body::before {
    background-color: var(--bg-dark);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48' viewBox='0 0 28 48'%3E%3Cpath fill='%23d1d5db' fill-opacity='0.3' d='M14 0L28 8v16l-14 8L0 24V8L14 0zm0 32l14-8v16l-14 8L0 40V24l14 8z'/%3E%3C/svg%3E");
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Padrão hexagonal (fundo) ===== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48' viewBox='0 0 28 48'%3E%3Cpath fill='%231a1a1a' fill-opacity='0.4' d='M14 0L28 8v16l-14 8L0 24V8L14 0zm0 32l14-8v16l-14 8L0 40V24l14 8z'/%3E%3C/svg%3E");
    background-size: var(--hex-size) calc(var(--hex-size) * 1.732);
    z-index: -1;
    pointer-events: none;
}

/* ===== Header (legado) ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(13, 13, 13, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    color: var(--accent-teal);
    font-size: 0.75rem;
}

.logo-seven {
    color: var(--accent-teal);
}

.logo-sec {
    color: var(--text-primary);
}

/* ===== Navegação principal ===== */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.nav-item i {
    font-size: 1.1rem;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* ===== Utilitários do header (direita) ===== */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: var(--bg-card);
}

.icon-btn.notification {
    position: relative;
}

.icon-btn .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
}

.avatar {
    position: relative;
    width: 36px;
    height: 36px;
    cursor: pointer;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--accent-red);
    border: 2px solid var(--bg-dark);
    border-radius: 50%;
}

/* ===== Conteúdo principal ===== */
.main-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 73px);
    padding: 2rem;
    position: relative;
}

.main-content > .view-section {
    flex: 1;
    min-height: 0;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s, border-color 0.2s;
    z-index: 10;
}

.carousel-btn:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.carousel-prev {
    left: 2rem;
}

.carousel-next {
    right: 2rem;
}

.main-content.view-arquivos-active .carousel-btn {
    display: none;
}

/* ===== Hero / Saudação ===== */
.view-painel .hero {
    text-align: center;
    max-width: 800px;
    width: 100%;
}

.greeting {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
}

.widgets {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.widget {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.widget:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

.widget-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.dnd-icon {
    background: var(--accent-red);
    color: white;
}

.dnd-icon i {
    font-size: 0.7rem;
}

.weather-icon {
    color: var(--accent-blue);
    font-size: 1.25rem;
}

.widget-text {
    white-space: nowrap;
}

.widget-weather .widget-weather-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.widget-city {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.widget-weather-chevron {
    font-size: 0.65rem;
    margin-left: 0.35rem;
    opacity: 0.6;
}

/* ===== Modal escolher cidade ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.modal-title {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.modal-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.modal-search i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modal-search input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.modal-search input::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

.modal-btn-location {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--accent-teal);
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: background 0.2s;
}

.modal-btn-location:hover {
    background: var(--bg-card-hover);
}

.modal-results {
    list-style: none;
    overflow-y: auto;
    max-height: 200px;
}

.modal-results li {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    transition: background 0.2s;
}

.modal-results li:hover {
    background: var(--bg-dark);
}

.modal-results .city-name {
    font-weight: 500;
}

.modal-results .city-region {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-results .city-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}

.modal-close:hover {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* ===== Views (Painel / Arquivos) ===== */
.view-section {
    display: none;
    width: 100%;
    max-width: 1100px;
    padding: 0 1rem;
}

.view-section.view-active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}

.view-arquivos.view-active {
    justify-content: flex-start;
    align-items: stretch;
}

.view-painel.view-active {
    display: flex;
}

/* ===== Arquivos (estilo Reddit/comunidade) ===== */
:root {
    --reddit-orange: #ff4500;
    --reddit-orange-hover: #ff5722;
}

.community-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    width: 100%;
    max-width: 900px;
}

.community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1rem;
}

.sidebar-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.sidebar-card h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.sidebar-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--reddit-orange);
    color: white;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-upload:hover {
    background: var(--reddit-orange-hover);
}

.btn-upload-block {
    width: 100%;
}

.sidebar-stats {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.sidebar-card.rules ul {
    list-style: none;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.sidebar-card.rules li {
    padding: 0.2rem 0;
}

.community-feed {
    min-width: 0;
}

.feed-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feed-sort {
    display: flex;
    gap: 0.25rem;
}

.sort-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sort-btn:hover,
.sort-btn.active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sort-btn.active {
    border-color: var(--reddit-orange);
    color: var(--reddit-orange);
}

.feed-toolbar select {
    margin-left: auto;
    padding: 0.4rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.arquivos-dropzone {
    border: 2px dashed var(--border-subtle);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.arquivos-dropzone.drag-over {
    border-color: var(--reddit-orange);
    background: rgba(255, 69, 0, 0.05);
}

.arquivos-dropzone i {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.arquivos-dropzone p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Post card estilo Reddit */
.feed-posts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-card {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s;
}

.file-card:hover {
    background: var(--bg-card-hover);
}

.file-card-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    background: var(--bg-dark);
    min-width: 40px;
}

.file-card-votes button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}

.file-card-votes button:hover {
    color: var(--reddit-orange);
}

.file-card-votes button.voted-up {
    color: var(--reddit-orange);
}

.file-card-votes button.voted-down {
    color: #7193ff;
}

.file-card-votes span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.file-card-body {
    flex: 1;
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    min-width: 0;
}

.file-card-preview {
    width: 80px;
    height: 80px;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border-radius: 6px;
    overflow: hidden;
}

.file-card-preview img,
.file-card-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-card-preview .file-icon {
    font-size: 1.75rem;
    color: var(--text-muted);
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.file-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.file-card-actions button {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.file-card-actions button:hover {
    background: var(--bg-dark);
    color: var(--reddit-orange);
}

/* Files grid layout - square preview */
#arquivos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.file-card.file-card-grid {
    flex-direction: column;
    padding: 0;
}

.file-card-grid .file-card-preview {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    position: relative;
    min-width: 0;
    border-radius: 8px 8px 0 0;
}

.file-card-grid .file-card-preview img,
.file-card-grid .file-card-preview video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.file-card-grid .file-card-preview .file-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.file-card-grid .file-card-info {
    padding: 0.75rem;
}

.file-card-grid .vote-like {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.file-card-grid .vote-like:hover,
.file-card-grid .vote-like.voted-up {
    color: var(--accent-teal);
}

.file-card-grid .file-card-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.file-card-grid .file-card-actions {
    margin-top: 0.5rem;
}

.file-card-grid .file-card-actions .btn-view,
.file-card-grid .file-card-actions .btn-download,
.file-card-grid .file-card-actions .btn-delete {
    padding: 0.25rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
}

.file-card-grid .file-card-actions a {
    color: var(--text-muted);
}

.file-card-grid .file-card-actions button:hover,
.file-card-grid .file-card-actions a:hover {
    color: var(--accent-teal);
}

.arquivos-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    display: none;
}

.arquivos-empty.visible {
    display: block;
}

.modal-preview {
    max-width: 90vw;
    max-height: 90vh;
    padding: 2rem;
}

.modal-preview img,
.modal-preview video {
    max-width: 100%;
    max-height: 80vh;
    display: block;
}

.modal-preview audio {
    width: 100%;
    max-width: 400px;
}

.modal-preview .preview-text {
    max-width: 600px;
    max-height: 70vh;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 0.9rem;
}

.modal-preview .preview-pdf {
    width: 100%;
    height: 80vh;
    border: none;
}

.modal-preview .preview-download {
    margin-top: 1rem;
}

.modal-preview .preview-download a {
    color: var(--accent-teal);
}

/* ===== Responsivo ===== */
@media (max-width: 1024px) {
    .main-nav .nav-item span {
        display: none;
    }

    .main-nav .nav-item {
        padding: 0.6rem;
    }

    .header-left {
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .main-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }

    .carousel-prev,
    .carousel-next {
        width: 40px;
        height: 40px;
        left: 0.5rem;
        right: 0.5rem;
    }

    .widgets {
        flex-direction: column;
    }

    .widget {
        width: 100%;
        justify-content: center;
    }

    .community-layout {
        grid-template-columns: 1fr;
    }

    .community-sidebar {
        order: 2;
    }

    .file-card-body {
        flex-wrap: wrap;
    }

    .file-card-preview {
        width: 60px;
        height: 60px;
        min-width: 60px;
    }
}
