/* ==== Design System e Variáveis (Dark Mode Moderno) ==== */
:root {
    --bg-main: #0E1117;
    --bg-secondary: #161b22;
    --acc-primary: #FF5722;
    /* Shopee Orange inspired */
    --acc-hover: #E64A19;
    --text-primary: #E6EDF3;
    --text-secondary: #8B949E;
    --border-color: #30363D;

    /* Glassmorphism settings */
    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Fonts */
    --font-main: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Base Layout */
.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
}

/* Top Header Navigation */
.main-header {
    min-height: 72px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    background: rgba(22, 27, 34, 0.85);
}

@media (max-width: 768px) {
    .main-header {
        height: auto;
        padding: 0.8rem 1.2rem;
        flex-wrap: wrap;
        gap: 0.8rem;
        justify-content: space-between;
        /* Added for top row elements */
    }

    .main-header .logo h2 {
        font-size: 1.2rem;
    }

    .header-user-actions {
        order: 2;
        min-width: unset;
        flex: 1;
        justify-content: flex-end;
        width: auto !important;
        /* Override previous width: 100% */
    }

    .nav-container {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }
}

.main-header .logo h2 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 700;
}

.main-header .logo span {
    color: var(--acc-primary);
}

.nav-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex: 1;
    justify-content: center;
}

.nav-menu {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-menu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-menu a.active {
    background-color: rgba(255, 87, 34, 0.1);
    color: var(--acc-primary);
    box-shadow: inset 0 0 0 1px rgba(255, 87, 34, 0.2);
}

.header-user-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 200px;
    justify-content: flex-end;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 3rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .main-content {
        padding: 1.5rem 1rem;
    }
}

.top-header {
    margin-bottom: 2.5rem;
    text-align: center;
    width: 100%;
}

.top-header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
}

.top-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Dashboard & Filters */
.filters-wrapper {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
    background: var(--bg-secondary);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 1200px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 0.5rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.filter-chip:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.filter-chip.active {
    background: var(--acc-primary);
    color: #fff;
    border-color: var(--acc-primary);
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

.hidden-filters {
    display: none !important;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.9rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--acc-primary);
    box-shadow: 0 0 0 2px rgba(255, 87, 34, 0.2);
}

/* Buttons */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

@media (max-width: 480px) {
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

.btn {
    padding: 0.8rem 1.6rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--acc-primary);
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

.btn-primary:hover {
    background-color: var(--acc-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Spinner for loading state */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--acc-primary);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
}

@media (max-width: 768px) {
    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1.5rem;
        width: calc(100% - 2rem);
        text-align: center;
        border-left: none;
        border-bottom: 4px solid var(--acc-primary);
    }
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left-color: #4CAF50;
}

.toast.error {
    border-left-color: #F44336;
}

/* === Listagem (Dashboard) === */
.filters-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.hidden-filters {
    display: none !important;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.filter-chip {
    padding: 0.4rem 1rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-chip:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.filter-chip.active {
    background: var(--acc-primary);
    border-color: var(--acc-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.2);
}

.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 600px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .card-thumb {
        height: 240px;
        /* Reduz altura para caber 2 colunas confortavelmente */
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (min-width: 901px) and (max-width: 1200px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1201px) {
    .grid-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

.video-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    border-color: var(--acc-primary);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
}

@media (hover: hover) {
    .video-card:hover {
        transform: translateY(-8px);
    }
}

.card-thumb {
    height: 420px;
    /* Formato Vertical 9:16 aproximado */
    background: #1a1f26;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    /* Skeleton animation */
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.05) 50%,
            rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.card-thumb:not(.has-video)::before {
    content: "▶";
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.5);
    z-index: 1;
}

.video-preview,
.img-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.img-preview[src],
.video-preview[src] {
    opacity: 1;
}

.video-error-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 5;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.img-preview {
    animation: ken-burns 20s infinite alternate linear;
}

@keyframes ken-burns {
    from {
        transform: scale(1) translate(0, 0);
    }

    to {
        transform: scale(1.15) translate(-2%, -2%);
    }
}

.video-card:hover .video-preview {
    transform: scale(1.02);
}

.video-preview,
.img-preview {
    border-bottom: 1px solid var(--border-color);
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Paginação */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.pagination-btn.active {
    background: var(--acc-primary);
    border-color: var(--acc-primary);
    color: #fff;
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 1rem;
}

.pagination-jump {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-left: 1.5rem;
    padding-left: 1.5rem;
    border-left: 1px solid var(--border-color);
}

.pagination-jump span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pagination-jump input {
    width: 60px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-align: center;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.pagination-jump input:focus {
    border-color: var(--acc-primary);
    box-shadow: 0 0 0 2px rgba(255, 87, 34, 0.2);
}

/* Responsiveness for Jump */
@media (max-width: 768px) {
    .pagination-wrapper {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .pagination-jump {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
    }

    .pagination-jump input {
        height: 35px;
        width: 50px;
    }
}

.card-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-main);
    color: var(--text-secondary);
}

.status-aguardando {
    color: #FFC107;
    border: 1px solid rgba(255, 193, 7, 0.3);
    background: rgba(255, 193, 7, 0.1);
}

.status-concluido {
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
    background: rgba(76, 175, 80, 0.1);
}

.card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.card-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

.card-title {
    font-size: 0.95rem !important;
    font-weight: 500;
    line-height: 1.3 !important;
    color: var(--text-primary);
    margin: 0.2rem 0 !important;
}

.card-link {
    font-size: 0.9rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-link:hover {
    text-decoration: underline;
}

.card-actions {
    padding: 1rem 1.2rem;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid var(--border-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* Responsiveness */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .logo h2 {
        font-size: 1.2rem;
        text-align: center;
    }

    .nav-container {
        width: 100%;
    }

    .nav-menu {
        flex-direction: row;
        justify-content: center;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        gap: 0.25rem;
        width: 100%;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        /* Firefox */
    }

    .nav-menu::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .nav-menu a {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
        white-space: nowrap;
        background: rgba(255, 255, 255, 0.03);
    }

    .glass-card {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .dashboard-actions {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        text-align: center;
    }

    .dashboard-actions h1 {
        font-size: 1.4rem;
    }

    .dashboard-actions p {
        font-size: 0.85rem;
    }

    /* Filters UX - Compact scroll for mobile */
    .filters-wrapper {
        padding: 1rem;
        gap: 1.2rem;
        margin-bottom: 1.5rem;
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
        gap: 0.6rem;
    }

    .filter-options {
        display: flex;
        flex-wrap: wrap;
        gap: 0.6rem;
    }

    .filter-group label {
        font-size: 0.75rem;
    }

    .filter-chip {
        padding: 0.6rem 0.8rem;
        font-size: 0.75rem;
        white-space: normal;
        flex: 1 1 calc(50% - 0.5rem);
        text-align: center;
        min-width: 100px;
        max-width: calc(50% - 0.5rem);
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1.2;
    }

    /* Card adjustments for mobile */
    .card-thumb {
        height: 180px;
    }

    .card-content {
        padding: 0.8rem;
    }

    .card-title {
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .card-actions {
        padding: 0.7rem;
    }

    .btn-small {
        width: 100%;
        justify-content: center;
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    .pagination-wrapper {
        gap: 0.3rem;
        margin-top: 1rem;
        justify-content: center;
    }

    .btn-page {
        min-width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    /* UX Refinements */
    body {
        padding: 0 1rem;
        /* Add padding to body for mobile to prevent overflow */
    }

    .form-actions {
        flex-direction: column;
        /* Stack buttons */
        gap: 0.5rem;
    }


    .pagination-wrapper {
        flex-wrap: wrap;
        /* Fix for very small screens */
    }
}

/* Specific Mobile Fix for Login */
@media (max-width: 480px) {
    .login-card {
        padding: 0 1.5rem;
    }

    body {
        overflow-y: auto !important;
        /* Allow scroll if content exceeds height */
    }
}