/* br.tv - Sistema de Gestão de Vídeos */

:root {
  --primary: #000000;
  --secondary: #6c757d;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --light: #f8f9fa;
  --dark: #1a1a1a;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --bg: #ffffff;
  --sidebar-bg: #000000;
  --sidebar-hover: #1a1a1a;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  color: var(--text);
  background: var(--light);
  line-height: 1.6;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar-bg);
  color: white;
  min-height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  z-index: 1000;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 2rem 1.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* Sidebar User Card */
.sidebar-user-card {
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: white;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-info .user-name {
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.user-info .badge-sm {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
}

/* Sidebar Navigation */
.sidebar nav {
  flex: 1;
  overflow-y: auto;
}

/* Sidebar Footer (User Card + Logout) */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .sidebar-user-card {
  border-bottom: none;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer .logout-link {
  color: rgba(255, 255, 255, 0.8);
  padding: 1rem 1.5rem;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.sidebar-footer .logout-link:hover {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border-left-color: #ef4444;
}

.nav-link {
  color: rgba(255,255,255,0.7);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 0.95rem;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: white;
  border-left-color: white;
}

.nav-link.active {
  background: var(--sidebar-hover);
  color: white;
  border-left-color: white;
  font-weight: 500;
}

.nav-link i {
  width: 20px;
  font-size: 1.1rem;
}

/* Main Content */
.main-content {
  margin-left: 240px;
  min-height: 100vh;
  background: var(--light);
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark);
  letter-spacing: -0.5px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  overflow: hidden;
}

.card-header {
  font-size: 1.1rem;
  font-weight: 600;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  color: var(--dark);
}

/* Tabelas dentro de cards não precisam de padding extra */
.card table {
  margin: 0;
}

.card .table-hover,
.card .table-minimal {
  margin-bottom: 0;
}

.stats-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.stats-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.stats-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stats-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stats-icon {
  font-size: 2rem;
  opacity: 0.2;
}

/* Tables */
.table-minimal,
.table-hover {
  width: 100%;
  border-collapse: collapse;
}

.table-minimal thead,
.table-hover thead {
  border-bottom: 2px solid var(--border);
  background: var(--light);
}

.table-minimal th,
.table-hover th {
  padding: 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.table-minimal td,
.table-hover td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

.table-minimal tbody tr:hover,
.table-hover tbody tr:hover {
  background: var(--light);
  transition: background 0.2s;
}

.table-hover tbody tr {
  transition: all 0.2s;
}

/* Melhorias para botões em tabelas */
.table-hover td button,
.table-minimal td button {
  white-space: nowrap;
}

.table-hover td .btn-sm,
.table-minimal td .btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

/* Container para scroll horizontal em mobile */
.card {
  overflow-x: auto;
}

/* Badges */
.badge {
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: inline-block;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-dark { background: #f3f4f6; color: #1f2937; }

/* User role badge */
.user-role-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  background: #000;
  color: #fff;
  margin-right: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-primary {
  background: var(--dark);
  color: white;
}

.btn-primary:hover {
  background: #333;
}

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: var(--dark);
}

.btn-outline:hover {
  background: var(--light);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 3rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -1px;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--dark);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--dark);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.alert {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Utilities */
.container {
  padding: 2rem;
  width: 100%;
  max-width: 100%;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  margin-bottom: 0;
}

.col-md-3, 
.col-md-6, 
.col-md-12 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  padding-bottom: 1.5rem;
  box-sizing: border-box;
}

.col-md-3 { 
  width: 25%;
  flex: 0 0 25%;
}

.col-md-6 { 
  width: 50%;
  flex: 0 0 50%;
}

.col-md-12 { 
  width: 100%;
  flex: 0 0 100%;
}

.text-muted {
  color: var(--text-secondary);
}

.text-end {
  text-align: right;
}

.d-none {
  display: none !important;
}

.d-flex {
  display: flex;
}

.align-items-center {
  align-items: center;
}

.justify-content-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 1rem;
}

.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

/* Espaçamento para rows */
.row.mt-4 {
  margin-top: 1.5rem;
}

.row + .row {
  margin-top: 1.5rem;
}

.spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
}

.modal.show {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal-dialog {
  background: white;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  animation: slideDown 0.3s;
  margin: auto;
  position: relative;
  z-index: 2001;
  pointer-events: auto;
}

.modal-dialog-lg {
  max-width: 800px;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--light);
  color: var(--text);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text);
}

.form-label.required::after {
  content: " *";
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  transition: all 0.2s;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.form-control:disabled {
  background: var(--light);
  cursor: not-allowed;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  display: block;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-check-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
  font-size: 0.875rem;
}

.invalid-feedback {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: none;
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid ~ .invalid-feedback {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive */

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-menu-toggle:hover {
  background: var(--sidebar-hover);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.sidebar.mobile-open {
  transform: translateX(0) !important;
}

.sidebar-overlay.active {
  display: block;
}

@media (max-width: 1024px) {
  .main-content {
    margin-left: 0;
    padding: 1.5rem;
    padding-top: 4rem; /* Espaço para o botão do menu */
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .page-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .page-actions {
    width: 100%;
  }
  
  .page-actions .btn {
    width: 100%;
  }
  
  /* Grid em tablets - 2 colunas */
  .col-md-3 {
    width: 50% !important;
    flex: 0 0 50% !important;
  }
  
  .col-md-6 {
    width: 100% !important;
    flex: 0 0 100% !important;
  }
}

@media (max-width: 768px) {
  
  /* Login Page */
  .login-card {
    padding: 2rem 1.5rem;
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }
  
  .login-logo h1 {
    font-size: 2rem;
  }
  
  .login-logo p {
    font-size: 0.875rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .stats-value {
    font-size: 1.75rem;
  }
  
  /* Sistema de Grid Responsivo */
  .col-md-3, 
  .col-md-6, 
  .col-md-12 {
    width: 100% !important;
    flex: 0 0 100% !important;
  }
  
  .row {
    margin-left: 0;
    margin-right: 0;
  }
  
  .col-md-3, 
  .col-md-6, 
  .col-md-12 {
    padding-left: 0;
    padding-right: 0;
  }
  
  /* Container */
  .container {
    padding: 1rem;
  }
  
  /* Tabelas responsivas - FIX PRINCIPAL */
  .card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    width: 100%;
    min-width: 600px; /* Força scroll horizontal quando necessário */
    display: table;
  }
  
  .table-minimal,
  .table-hover {
    width: 100%;
    min-width: 600px;
  }
  
  /* Container de tabelas */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: -1rem;
    padding: 1rem;
  }
  
  /* Cards */
  .card {
    margin-bottom: 1rem;
  }
  
  /* Modais */
  .modal-dialog {
    margin: 1rem;
    max-width: calc(100% - 2rem);
  }
  
  /* Formulários */
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Botões */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  /* Status badges */
  .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* Info Panel */
  .info-panel {
    padding: 0.75rem;
  }
  
  .info-item {
    font-size: 0.875rem;
  }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1040;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s;
}

.mobile-menu-toggle:hover {
  background: var(--sidebar-hover);
  transform: scale(1.05);
}

.mobile-menu-toggle:active {
  transform: scale(0.98);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}

/* Responsive Media Queries */
@media (max-width: 480px) {
  .page-title {
    font-size: 1.5rem;
  }
  
  .stats-label {
    font-size: 0.75rem;
  }
  
  .stats-value {
    font-size: 1.5rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  
  .btn-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
  }
  
  table {
    font-size: 0.875rem;
  }
  
  th, td {
    padding: 0.5rem;
  }
  
  .modal-header h3 {
    font-size: 1.25rem;
  }
  
  .form-label {
    font-size: 0.875rem;
  }
  
  .form-control {
    font-size: 0.875rem;
    padding: 0.5rem;
  }
}

/* Landscape tablets */
@media (min-width: 769px) and (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .col-md-3 {
    width: 50%;
  }
  
  .col-md-6 {
    width: 100%;
  }
}

/* Print styles */
@media print {
  .sidebar,
  .mobile-menu-toggle,
  .page-actions,
  .btn {
    display: none;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  table {
    border: 1px solid #000;
  }
  
  th, td {
    border: 1px solid #000;
  }
}

