/* ============================================
   MAESTRO - CRM Frontend Styles
   ============================================ */

/* === ROOT VARIABLES === */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #1f2937;
  --light: #f9fafb;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --transition: all 0.2s ease;
}

/* === GLOBAL RESETS === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

/* === UTILITY CLASSES === */
.hidden {
  display: none !important;
}

.loading {
  opacity: 0.6;
  pointer-events: none;
  cursor: wait !important;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

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

/* === CARD COMPONENTS === */
.card {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark);
}

/* === BUTTON STYLES === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

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

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: var(--light);
}

.btn-success {
  background-color: var(--success);
  color: white;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

/* === FORM ELEMENTS === */
.form-group {
  margin-bottom: 1rem;
}

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

.form-control,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: var(--transition);
  background-color: white;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

/* === TAG COMPONENTS === */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 9999px;
  transition: var(--transition);
}

.tag-removable {
  cursor: pointer;
  padding-right: 0.375rem;
}

.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.tag-remove:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* === MODAL OVERLAY === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.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;
  color: var(--dark);
}

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

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

.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;
}

/* === KANBAN BOARD === */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-column {
  min-width: 320px;
  flex-shrink: 0;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
}

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

.kanban-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kanban-count {
  background: var(--light);
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.kanban-cards {
  padding: 1rem;
  min-height: 200px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

.kanban-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: grab;
  transition: var(--transition);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kanban-card.dragging {
  opacity: 0.5;
}

/* === TABLE STYLES === */
.table-container {
  overflow-x: auto;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  background-color: var(--light);
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
}

.table tbody tr:hover {
  background-color: var(--light);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* === BADGE COMPONENTS === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-success { background-color: #d1fae5; color: #065f46; }
.badge-warning { background-color: #fef3c7; color: #92400e; }
.badge-danger { background-color: #fee2e2; color: #991b1b; }
.badge-info { background-color: #dbeafe; color: #1e40af; }
.badge-secondary { background-color: var(--light); color: #4b5563; }

/* === SIDEBAR NAVIGATION === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: white;
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-nav {
  list-style: none;
}

.sidebar-item {
  margin-bottom: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  color: #6b7280;
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}

.sidebar-link:hover {
  background-color: var(--light);
  color: var(--primary);
}

.sidebar-link.active {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-right: 3px solid var(--primary);
}

/* Dropdown styles */
.sidebar-dropdown {
  margin-bottom: 0;
}

.sidebar-dropdown-toggle {
  cursor: pointer;
  font-weight: 600;
  color: #374151;
}

.sidebar-dropdown-toggle:hover {
  background-color: var(--light);
  color: var(--primary);
}

.sidebar-dropdown-toggle.active {
  background-color: rgba(99, 102, 241, 0.05);
  color: var(--primary);
}

.sidebar-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  background-color: #f9fafb;
  border-left: 2px solid #e5e7eb;
  margin-left: 1.5rem;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

.sidebar-submenu .sidebar-item {
  margin-bottom: 0;
}

.sidebar-sublink {
  padding: 0.625rem 1.5rem;
  padding-left: 2.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
}

.sidebar-sublink:hover {
  background-color: #f3f4f6;
  color: var(--primary);
}

.sidebar-sublink.active {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  border-right: 3px solid var(--primary);
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: 260px;
  padding: 2rem;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1rem;
  color: #6b7280;
}

/* === FILTERS BAR === */
.filters-bar {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 250px;
  padding: 0.625rem 1rem;
  padding-left: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9375rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
  background-size: 1.25rem;
}

/* === PAGINATION === */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination-btn {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--light);
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .kanban-board {
    flex-direction: column;
  }
  
  .kanban-column {
    min-width: 100%;
  }
}

/* === LOADING SPINNER === */
.spinner {
  border: 3px solid var(--light);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  min-width: 300px;
  padding: 1rem 1.25rem;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: var(--info); }

.toast-message {
  flex: 1;
  font-size: 0.9375rem;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

/* ============================================
   ANDAMENTOS E PUBLICAÇÕES - ESTILOS
   ============================================ */

/* Estatísticas Cards */
.stat-card {
  display: flex;
  align-items: center;
  padding: 1.25rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-size: 1.5rem;
  color: white;
}

.stat-info h3 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: bold;
  color: #2d3748;
}

.stat-info p {
  margin: 0;
  font-size: 0.875rem;
  color: #718096;
}

/* Publicações Cards */
.publicacao-card {
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.publicacao-nao-lida {
  border-left-color: #ef4444;
  background-color: #fef2f2;
}

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

.publicacao-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Andamentos Cards */
.andamento-card {
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.andamento-urgente {
  border-left-color: #ef4444;
  background-color: #fef2f2;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #718096;
}

.empty-state i {
  color: #cbd5e0;
  margin-bottom: 1rem;
}

.empty-state h3 {
  color: #4a5568;
  margin-bottom: 0.5rem;
}

/* Bootstrap-like utilities */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.5rem;
}

.col-md-2, .col-md-3, .col-md-4, .col-md-6, .col-md-12 {
  padding: 0 0.5rem;
}

.col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-md-3 { flex: 0 0 25%; max-width: 25%; }
.col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-md-6 { flex: 0 0 50%; max-width: 50%; }
.col-md-12 { flex: 0 0 100%; max-width: 100%; }

.g-3 {
  margin: 0 -0.75rem;
}

.g-3 > * {
  padding: 0 0.75rem;
  margin-bottom: 1rem;
}

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-3 { margin-left: 1rem; }

.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.align-items-start { align-items: flex-start; }
.align-items-center { align-items: center; }
.flex-grow-1 { flex-grow: 1; }
.gap-2 { gap: 0.5rem; }

.text-muted { color: #718096; }
.text-danger { color: #ef4444; }
.text-warning { color: #f59e0b; }
.small { font-size: 0.875rem; }

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

.alert-info {
  background-color: #dbeafe;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

.alert-success {
  background-color: #d1fae5;
  border: 1px solid #6ee7b7;
  color: #065f46;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  color: white;
}

.bg-primary { background-color: #3b82f6; }
.bg-secondary { background-color: #6b7280; }
.bg-success { background-color: #10b981; }
.bg-danger { background-color: #ef4444; }
.bg-warning { background-color: #f59e0b; color: #78350f; }
.bg-info { background-color: #06b6d4; }
.bg-dark { background-color: #1f2937; }

.btn-group {
  display: flex;
  gap: 0.25rem;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-outline-secondary { background: white; color: #6b7280; border: 1px solid #d1d5db; }
.btn-outline-primary { background: white; color: #3b82f6; border: 1px solid #3b82f6; }
.btn-outline-success { background: white; color: #10b981; border: 1px solid #10b981; }
.btn-outline-danger { background: white; color: #ef4444; border: 1px solid #ef4444; }
.btn-outline-warning { background: white; color: #f59e0b; border: 1px solid #f59e0b; }

.btn-warning { background: #f59e0b; color: white; border: none; }

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

.form-check-input {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
  margin: 0;
}

@media (max-width: 768px) {
  .col-md-2, .col-md-3, .col-md-4, .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}
