/* ==========================================================================
   Estilos Gerais & Variáveis de Design (Dark Mode Moderno)
   ========================================================================== */
:root {
    --bg-darker: #090a0f;
    --bg-main: #0f121a;
    --bg-card: #161a26;
    --bg-card-hover: #1c2233;
    --border-color: #262c3f;
    --border-focus: #6366f1;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);

    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg: rgba(239, 68, 68, 0.12);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* ==========================================================================
   Header & Navegação
   ========================================================================== */
.site-header {
    background: var(--bg-darker);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo svg {
    color: var(--primary);
}

.badge-admin {
    font-size: 0.7rem;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ==========================================================================
   Botões & Controles
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.925rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    font-size: 0.825rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    font-size: 1.05rem;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-lg);
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #6d28d9 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
    color: #fff;
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

/* ==========================================================================
   Cards & Layout Base
   ========================================================================== */
.main-content {
    flex: 1;
    padding: 2.5rem 0;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.card-body {
    padding: 1.75rem;
}

/* ==========================================================================
   Formulários & Inputs
   ========================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-control-sm {
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Área de Dropzone / Upload
   ========================================================================== */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: rgba(15, 18, 26, 0.6);
    padding: 2.75rem 1.5rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: all 0.25s ease;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.dropzone .file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-icon {
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.dropzone-content h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.dropzone-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dropzone-sub .highlight {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 500;
}

.file-selected-info {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--success);
    background: var(--success-bg);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* ==========================================================================
   Barra de Progresso
   ========================================================================== */
.progress-area {
    margin-top: 1.5rem;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.65rem;
    color: var(--text-primary);
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #1c2233;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #a855f7 100%);
    border-radius: 999px;
    transition: width 0.2s ease;
}

/* ==========================================================================
   Card de Sucesso Pós Upload
   ========================================================================== */
.upload-success-card {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.success-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.success-content {
    flex: 1;
}

.success-content h3 {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.success-title {
    color: var(--text-secondary);
    font-size: 0.925rem;
    margin-bottom: 1rem;
}

.link-copy-box {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.link-copy-box .form-control {
    flex: 1;
    min-width: 240px;
    background: #000;
    color: #a5b4fc;
    font-family: monospace;
    font-size: 0.875rem;
}

/* ==========================================================================
   Tabela de Vídeos (Painel Admin)
   ========================================================================== */
.list-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.badge {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.8rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    margin-left: 0.35rem;
}

.table-responsive {
    overflow-x: auto;
}

.videos-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.videos-table th {
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.videos-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.videos-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.video-title-cell strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.video-id-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
}

.views-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.actions-cell {
    text-align: right;
    white-space: nowrap;
}

.actions-cell .btn {
    margin-left: 0.35rem;
}

.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 1.15rem;
}

/* ==========================================================================
   Página do Player (watch.php)
   ========================================================================== */
.player-wrapper {
    max-width: 960px;
    margin: 0 auto;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    outline: none;
}

.video-details {
    margin-top: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.video-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.video-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    min-width: 250px;
}

.video-actions {
    display: flex;
    gap: 0.75rem;
}

.video-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.not-found-card {
    text-align: center;
    padding: 4rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 500px;
    margin: 3rem auto;
}

.not-found-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

/* ==========================================================================
   Página de Login
   ========================================================================== */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.25rem;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.login-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.alert-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

.login-hint {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.login-hint code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    color: #cbd5e1;
}

.back-link {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.back-link:hover {
    color: var(--text-primary);
}

/* ==========================================================================
   Página Home (Hero)
   ========================================================================== */
.hero-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 65vh;
}

.hero-card {
    text-align: center;
    max-width: 800px;
}

.hero-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 0.35rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.hero-card h1 {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.2rem;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-card p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 3.5rem;
    text-align: left;
}

.feature-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    transition: transform 0.2s ease;
}

.feature-item:hover {
    transform: translateY(-3px);
    border-color: var(--border-focus);
}

.feature-icon {
    font-size: 1.8rem;
    margin-bottom: 0.75rem;
}

.feature-item h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.feature-item p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1e1b4b;
    color: #e0e7ff;
    border: 1px solid var(--primary);
    padding: 0.85rem 1.4rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glow);
    font-weight: 500;
    font-size: 0.925rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Responsividade
   ========================================================================== */
@media (max-width: 768px) {
    .hero-card h1 {
        font-size: 1.85rem;
    }
    .video-title {
        font-size: 1.25rem;
    }
    .video-header-row {
        flex-direction: column;
    }
    .video-actions {
        width: 100%;
    }
    .video-actions .btn {
        flex: 1;
    }
    .link-copy-box {
        flex-direction: column;
    }
    .actions-cell .btn span {
        display: none;
    }
}
