:root { --bg-dark: #0a0705; --card-dark: #120e0a; --text-main: #e8e0d5; --text-muted: #a69888; --gold: #c69c6d; --gold-hover: #e0b686; --terracota: #8c3b26; --danger: #b33939; --success: #218c74; --warning: #d9801c; --admin-sidebar: #050302; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: var(--bg-dark); color: var(--text-main); font-family: 'Lora', serif; height: 100vh; overflow: hidden; }
h1, h2, h3, h4 { font-family: 'Playfair Display', serif; font-weight: 700; }
.hidden { display: none !important; }

/* Utilitários Base */
#alert-box { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); padding: 15px 25px; border-radius: 4px; z-index: 9999; box-shadow: 0 4px 10px rgba(0,0,0,0.5); transition: 0.3s; width: 90%; max-width: 400px; text-align: center; font-weight: bold;}
.alert-error { background-color: var(--danger); color: white; } .alert-success { background-color: var(--success); color: white; } .alert-warning { background-color: var(--warning); color: #100c08; }
.btn-primary { width: 100%; padding: 12px; background-color: var(--gold); color: var(--bg-dark); border: none; border-radius: 4px; font-size: 16px; font-weight: 700; cursor: pointer; font-family: 'Lora', serif; transition: 0.3s; }
.btn-primary:hover { background-color: var(--gold-hover); } .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-outline { width: 100%; padding: 10px; background: transparent; color: var(--gold); border: 1px solid var(--gold); border-radius: 4px; cursor: pointer; transition: 0.3s; font-family: 'Lora', serif; font-weight: bold; }
.btn-outline:hover { background: var(--gold); color: var(--bg-dark); }
.input-group { margin-bottom: 20px; text-align: left; } .input-group label { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 14px; }
.input-group input, .custom-select, .custom-textarea, .custom-input { width: 100%; padding: 12px; background-color: rgba(255,255,255,0.05); border: 1px solid #4a3b2f; border-radius: 4px; color: var(--text-main); font-family: 'Lora', serif;}
.input-group input:focus, .custom-select:focus, .custom-textarea:focus { outline: none; border-color: var(--gold); }
::-webkit-calendar-picker-indicator { filter: invert(1); cursor: pointer; }
.text-center { text-align: center; }

/* Auth */
.auth-container { height: 100vh; display: flex; justify-content: center; align-items: center; padding: 20px; }
.auth-card { background-color: var(--card-dark); padding: 40px; border-radius: 8px; border: 1px solid #33271f; box-shadow: 0 10px 30px rgba(0,0,0,0.8); text-align: center; width: 100%; max-width: 400px; }
.logo-title { color: var(--gold); margin-bottom: 5px; } .subtitle { color: var(--text-muted); font-style: italic; margin-bottom: 30px; } .toggle-text { margin-top: 20px; font-size: 14px; color: var(--text-muted); } .toggle-text a { color: var(--gold); text-decoration: none; font-weight: bold; }

/* Modais Universais */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0,0,0,0.9); display: flex; justify-content: center; align-items: center; z-index: 3000; backdrop-filter: blur(5px); }
.modal-content { background-color: var(--card-dark); padding: 30px; border-radius: 8px; border: 1px solid var(--gold); width: 90%; max-width: 600px; box-shadow: 0 10px 40px rgba(0,0,0,0.9); max-height: 90vh; overflow-y: auto; position: relative;}
.modal-small { max-width: 400px; }
.modal-highlight-text { margin-bottom: 5px; color: var(--gold); font-weight: bold; }
.modal-subtext { margin-bottom: 20px; font-size: 13px; color: var(--text-muted); }
.modal-actions { display: flex; gap: 10px; }
.close-btn { position: absolute; top: 15px; right: 15px; background: transparent; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; font-weight: bold;} .close-btn:hover { color: var(--danger); }

/* Perfil & Histórico Timeline */
.profile-avatar { font-size: 50px; margin-bottom: 10px; }
.timeline-container { padding: 10px; border-left: 2px solid var(--gold); margin-left: 10px; }
.timeline-item { position: relative; padding-left: 20px; margin-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -26px; top: 0; width: 10px; height: 10px; background: var(--gold); border-radius: 50%; }
.timeline-date { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 2px; }
.timeline-text { font-size: 14px; color: var(--text-main); }

/* Navbar Biblioteca */
.dashboard-layout { display: flex; flex-direction: column; height: 100vh; width: 100vw; background-color: var(--bg-dark); }
.topbar-library { position: fixed; top: 0; width: 100%; z-index: 100; background: var(--bg-dark); padding: 15px 40px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #33271f; }
.search-container { flex: 1; display: flex; justify-content: center; padding: 0 20px; }
.search-bar { width: 100%; max-width: 400px; padding: 10px 20px; border-radius: 30px; border: 1px solid #4a3b2f; background-color: rgba(255,255,255,0.05); color: var(--text-main); font-family: 'Lora', serif; transition: 0.3s; }
.search-bar:focus { outline: none; border-color: var(--gold); background-color: rgba(255,255,255,0.1); width: 100%; max-width: 450px; }
.user-menu { display: flex; align-items: center; gap: 15px; }
.badge-days { background-color: rgba(198, 156, 109, 0.2); color: var(--gold); border: 1px solid var(--gold); padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; }
.icon-btn { background: transparent; border: none; font-size: 20px; cursor: pointer; position: relative; transition: 0.2s;} .icon-btn:hover{ transform: scale(1.1); }

/* Notificações Sino */
.notif-wrapper { position: relative; }
.notif-dot { position: absolute; top: 0; right: -2px; width: 10px; height: 10px; background: var(--danger); border-radius: 50%; border: 2px solid var(--bg-dark); }
.notif-dropdown { position: absolute; top: 35px; right: -50px; width: 280px; background: var(--card-dark); border: 1px solid #33271f; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.9); z-index: 200; overflow: hidden; }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item { padding: 12px; border-bottom: 1px solid #2a201a; display: flex; gap: 10px; align-items: center; cursor: pointer; transition: 0.2s; }
.notif-item:hover { background: rgba(198, 156, 109, 0.1); }
.notif-img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; }
.notif-text { font-size: 12px; color: var(--text-main); line-height: 1.3; } .notif-text strong { color: var(--gold); }

/* Abas de Navegação (Drive Style) */
.library-tabs { display: flex; justify-content: center; gap: 20px; padding: 15px 20px; background: var(--bg-dark); border-bottom: 1px solid #2a201a; margin-top: 70px; /* Evita ficar por baixo da topbar fixa */ }
.tab-btn { background: transparent; border: none; color: var(--text-muted); font-family: 'Lora', serif; font-size: 15px; font-weight: bold; padding: 5px 15px; cursor: pointer; transition: 0.3s; border-bottom: 2px solid transparent; }
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--gold); border-bottom-color: var(--gold); }

/* Corpo da Biblioteca */
.library-main { flex: 1; overflow-y: auto; overflow-x: hidden; padding-bottom: 50px; position: relative;}
.floating-btn { position: fixed; bottom: 20px; right: 20px; background: var(--gold); color: var(--bg-dark); border: none; padding: 12px 20px; border-radius: 30px; font-weight: bold; font-family: 'Lora', serif; box-shadow: 0 4px 15px rgba(0,0,0,0.5); cursor: pointer; z-index: 90; transition: 0.3s;}
.floating-btn:hover { transform: scale(1.05); }

/* Hero Banner */
.hero-banner { width: 100%; height: 60vh; background-size: cover; background-position: center; position: relative; display: flex; align-items: flex-end; transition: 0.3s; margin-bottom: 20px;}
.hero-banner::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(to top, var(--bg-dark) 0%, rgba(10,7,5,0.4) 100%); z-index: 1; }
.hero-content { position: relative; z-index: 2; padding: 40px 60px; max-width: 800px; }
.hero-title { font-size: 42px; color: white; margin-bottom: 15px; text-shadow: 2px 2px 8px rgba(0,0,0,0.8); }
.hero-desc { font-size: 16px; color: #ccc; margin-bottom: 25px; text-shadow: 1px 1px 4px rgba(0,0,0,0.8); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-btn { width: auto; padding: 10px 25px; font-size: 16px; display: inline-flex; align-items: center; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.badge-destaque { background-color: rgba(198, 156, 109, 0.9); color: var(--bg-dark); padding: 5px 12px; display: inline-block; margin-bottom: 10px; font-weight: bold; }

/* Prateleiras */
.catalog-container { padding: 0 40px; position: relative; z-index: 3; }
.category-row { margin-bottom: 40px; }
.category-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 15px; border-left: 4px solid var(--terracota); padding-left: 10px; }
.category-title { color: var(--gold); font-size: 20px; line-height: 1; }
.btn-ver-tudo { background: transparent; border: none; color: var(--text-muted); font-size: 13px; font-weight: bold; cursor: pointer; transition: 0.2s;} .btn-ver-tudo:hover { color: var(--gold); }
.media-slider { display: flex; gap: 15px; overflow-x: auto; padding: 10px 5px; scroll-behavior: smooth; -ms-overflow-style: none; scrollbar-width: none; }
.media-slider::-webkit-scrollbar { display: none; }

/* View "Ver Tudo" (Grade Infinita) */
.grid-container { padding: 20px 40px; }
.grid-header { display: flex; align-items: center; gap: 20px; margin-bottom: 30px; border-bottom: 1px solid #33271f; padding-bottom: 15px;}
.grid-content { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }

/* Cartão do Acervo */
.media-card { min-width: 160px; width: 160px; height: 240px; position: relative; cursor: pointer; border-radius: 6px; overflow: hidden; transition: 0.3s ease; border: 1px solid #33271f; background-color: var(--card-dark); flex-shrink: 0; }
.grid-content .media-card { min-width: 100%; width: 100%; } /* Na grade ele preenche o espaço */
.media-card img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.media-card:hover { transform: scale(1.05); z-index: 10; border-color: var(--gold); box-shadow: 0 10px 20px rgba(0,0,0,0.8); }
.btn-fav-card { position: absolute; top: 10px; right: 10px; z-index: 15; background: rgba(0,0,0,0.6); border: none; font-size: 20px; border-radius: 50%; width: 35px; height: 35px; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: 0.2s; opacity: 0.8;}
.btn-fav-card:hover { transform: scale(1.2); opacity: 1; }
.fav-active { color: #e74c3c; text-shadow: 0 0 10px rgba(231, 76, 60, 0.8); } .fav-inactive { color: rgba(255,255,255,0.5); }
.dynamic-cover { width: 100%; height: 100%; background: linear-gradient(135deg, #1a1410 0%, #33271f 100%); display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 15px; text-align: center; border: 1px solid rgba(198, 156, 109, 0.3); }
.dynamic-cover-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.8; } .dynamic-cover-title { color: var(--gold); font-family: 'Playfair Display', serif; font-size: 14px; font-weight: bold; line-height: 1.2; } .dynamic-cover-type { color: var(--text-muted); font-size: 10px; margin-top: 10px; text-transform: uppercase; font-weight: bold; }
.media-card::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 60%; background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%); opacity: 0; transition: 0.3s; pointer-events: none;}
.media-card:hover::after { opacity: 1; }
.media-card-info { position: absolute; bottom: 10px; left: 10px; right: 10px; z-index: 2; opacity: 0; transition: 0.3s; transform: translateY(10px); pointer-events: none;}
.media-card:hover .media-card-info { opacity: 1; transform: translateY(0); }
.media-card-title { font-size: 13px; color: white; font-weight: bold; line-height: 1.2; margin-bottom: 3px; }

/* Player Mobile First */
.media-modal-content { max-width: 1000px; height: 95vh; display: flex; flex-direction: column; padding: 20px;}
.media-header-controls { display: flex; justify-content: flex-end; align-items: center; gap: 15px; margin-bottom: 10px; }
.media-title { color: var(--gold); font-size: 20px; margin-bottom: 5px; } .media-author { color: var(--text-muted); font-style: italic; margin-bottom: 10px; font-size: 13px;} 
.media-desc { display: none; } /* Oculto para não roubar espaço do PDF */
.media-player-container { flex: 1; width: 100%; background: #000; border-radius: 8px; overflow: hidden; display: flex; justify-content: center; align-items: center; position: relative; }
.media-player-container iframe { width: 100%; height: 100%; border: none; }
.audio-cover { width: 200px; height: 200px; object-fit: cover; border-radius: 50%; border: 4px solid var(--gold); animation: spin 10s linear infinite; margin-bottom: 20px; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.audio-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; }

/* Admin Layout Base */
.admin-layout { display: flex; height: 100vh; width: 100vw; background-color: var(--bg-dark); }
.mobile-menu-toggle { display: none; position: fixed; top: 15px; left: 15px; z-index: 1001; background: var(--gold); color: var(--bg-dark); border: none; padding: 10px 15px; border-radius: 4px; font-size: 20px; cursor: pointer; }
.mobile-menu-close { display: none; position: absolute; top: 15px; right: 15px; background: transparent; border: none; color: var(--gold); font-size: 24px; cursor: pointer; }
.admin-sidebar { width: 250px; background-color: var(--admin-sidebar); border-right: 1px solid #33271f; display: flex; flex-direction: column; transition: 0.3s; z-index: 1000;}
.sidebar-header { padding: 30px 20px; text-align: center; border-bottom: 1px solid #33271f; } .sidebar-header h2 { color: var(--gold); font-size: 20px; }
.sidebar-nav { flex: 1; padding: 20px 0; display: flex; flex-direction: column; }
.admin-nav-btn { background: transparent; border: none; color: var(--text-muted); padding: 15px 20px; text-align: left; font-family: 'Lora', serif; font-size: 15px; cursor: pointer; transition: 0.3s; border-left: 4px solid transparent; }
.admin-nav-btn:hover { color: var(--text-main); } .admin-nav-btn.active { background-color: rgba(198, 156, 109, 0.1); color: var(--gold); border-left-color: var(--gold); font-weight: bold; }
.sidebar-footer { padding: 20px; border-top: 1px solid #33271f; }
.admin-main { flex: 1; overflow-y: auto; padding: 40px; }

.view-title { color: var(--text-main); font-size: 24px; margin-bottom: 30px; padding-bottom: 10px; border-bottom: 1px solid #33271f; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card { background-color: var(--card-dark); padding: 20px; border-radius: 8px; border-top: 4px solid var(--gold); border: 1px solid #33271f; border-top-width: 4px; }
.stat-card h4 { color: var(--text-muted); font-size: 12px; text-transform: uppercase; margin-bottom: 10px; } .stat-number { color: var(--text-main); font-size: 28px; font-family: 'Playfair Display', serif; }
.stat-success { border-top-color: var(--success); } .stat-success .stat-number { color: var(--success); } .stat-warning { border-top-color: var(--warning); } .stat-warning .stat-number { color: var(--warning); } .stat-danger { border-top-color: var(--danger); } .stat-danger .stat-number { color: var(--danger); }

.chart-container { background-color: var(--card-dark); padding: 25px; border-radius: 8px; border: 1px solid #33271f; }
.mobile-header-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.table-container { background-color: var(--card-dark); border-radius: 8px; border: 1px solid #33271f; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; text-align: left; min-width: 600px;} .admin-table th, .admin-table td { padding: 12px 15px; border-bottom: 1px solid #33271f; font-size: 14px; vertical-align: middle; }
.admin-table th { color: var(--gold); background-color: rgba(0,0,0,0.2); }
.badge { padding: 4px 8px; border-radius: 20px; font-size: 10px; font-weight: bold; text-transform: uppercase; }
.badge-pendente { color: var(--warning); border: 1px solid var(--warning); } .badge-aprovado { color: var(--success); border: 1px solid var(--success); } .badge-bloqueado { color: var(--danger); border: 1px solid var(--danger); }

.content-management-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; align-items: start; }
.admin-panel-box { background-color: var(--card-dark); padding: 25px; border-radius: 8px; border: 1px solid #33271f; } .admin-panel-box h3 { color: var(--gold); margin-bottom: 20px; font-size: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
.full-width { grid-column: span 2; }
.file-input { padding: 6px !important; background-color: transparent !important; color: var(--text-muted) !important; cursor: pointer; } .file-input::-webkit-file-upload-button { background: var(--gold); color: var(--bg-dark); border: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; font-weight: bold; margin-right: 15px; }
.capa-miniatura { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid var(--gold); }
.admin-table-info { display: flex; flex-direction: column; } .admin-table-info strong { color: var(--text-main); font-size: 14px;} .admin-table-info small { color: var(--text-muted); font-size: 11px;}
.action-btn-group { display: flex; gap: 5px; }

/* RESPONSIVIDADE (Celular Perfeito) */
@media (max-width: 900px) {
    .topbar-library { padding: 15px; flex-wrap: wrap; gap: 10px; justify-content: center; }
    .logo-mobile { font-size: 18px !important; width: 100%; text-align: center; margin-bottom: 5px;}
    .search-container { order: 3; width: 100%; padding: 0; }
    .user-menu { position: absolute; top: 15px; right: 15px; gap: 10px;}
    .badge-days { display: none !important; } /* Oculta dias no mobile top pra limpar a tela */
    .admin-btn-mobile { display: none !important; }
    .logout-btn-mobile { padding: 4px 10px !important; font-size: 12px !important; }
    
    .library-tabs { margin-top: 100px; padding: 10px; gap: 10px; overflow-x: auto; justify-content: flex-start; }
    .tab-btn { white-space: nowrap; font-size: 13px; padding: 5px 10px;}
    
    .catalog-container, .grid-container { padding: 0 15px; }
    .hero-content { padding: 20px; } .hero-title { font-size: 28px; }
    
    .content-management-grid, .form-grid-2 { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
    .admin-panel-box { grid-column: span 1 !important; }
    
    .mobile-menu-toggle, .mobile-menu-close { display: block; }
    .admin-sidebar { position: fixed; left: -250px; height: 100%; box-shadow: 5px 0 15px rgba(0,0,0,0.8); }
    .admin-sidebar.open { left: 0; }
    .admin-main { padding: 60px 15px 20px 15px; }
    .mobile-header-flex { flex-direction: column; align-items: flex-start; gap: 10px; }
}