/* Import modern typography */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #131c31;
  --bg-card: rgba(30, 41, 59, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Accent Colors */
  --accent-primary: #8b5cf6; /* Indigo/Violet */
  --accent-primary-hover: #7c3aed;
  --accent-success: #10b981; /* Emerald */
  --accent-success-hover: #059669;
  --accent-warning: #f59e0b; /* Amber */
  --accent-danger: #ef4444; /* Rose */
  --accent-info: #0ea5e9; /* Sky Blue */
  
  /* Shadows & Glows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --glow-primary: 0 0 15px rgba(139, 92, 246, 0.3);
  --glow-success: 0 0 15px rgba(16, 185, 129, 0.3);
  --glow-danger: 0 0 15px rgba(239, 68, 68, 0.3);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(15, 23, 42, 0.95) 0px, transparent 70%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-secondary);
  border-radius: var(--border-radius-sm);
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background-color: rgba(19, 28, 49, 0.85);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 3rem;
}

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

.logo-icon {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-success));
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: var(--glow-primary);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.7rem;
  color: var(--accent-success);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 4px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-item i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.nav-item:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
  color: white;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(16, 185, 129, 0.05));
  border-left: 3px solid var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 2.5rem 3rem;
  max-width: 1200px;
  width: calc(100% - 280px);
}

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

.header-title h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* Glassmorphic Cards */
.card {
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
}

.card-title i {
  color: var(--accent-primary);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

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

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: var(--glow-primary);
  background-color: rgba(15, 23, 42, 0.8);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  color: white;
  box-shadow: var(--glow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-success), var(--accent-success-hover));
  color: white;
  box-shadow: var(--glow-success);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

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

.btn-danger:hover {
  background-color: #dc2626;
  box-shadow: var(--glow-danger);
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.4s ease-out forwards;
}

.tab-panel.active {
  display: block;
}

/* Decision Tree Styles */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.option-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.option-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: transparent;
  transition: var(--transition-smooth);
}

.option-card:hover {
  background: rgba(30, 41, 59, 0.8);
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

.option-card.selected {
  background: rgba(139, 92, 246, 0.08);
  border-color: var(--accent-primary);
  box-shadow: var(--glow-primary);
}

.option-card.selected::before {
  background: var(--accent-primary);
}

.option-icon {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  display: inline-block;
  transition: var(--transition-smooth);
}

.option-card.selected .option-icon {
  transform: scale(1.1);
}

.option-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.option-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Result Section */
.result-box {
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  margin-top: 2rem;
  animation: slideUp 0.4s ease-out forwards;
}

.risk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.risk-indicator {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--border-radius-md);
  background: rgba(15, 23, 42, 0.4);
  flex-grow: 1;
}

.risk-badge {
  padding: 0.5rem 1.25rem;
  border-radius: 9999px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.risk-critico {
  background-color: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid var(--accent-danger);
  box-shadow: var(--glow-danger);
}

.risk-alto {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fde047;
  border: 1px solid var(--accent-warning);
}

.risk-medio {
  background-color: rgba(14, 165, 233, 0.15);
  color: #7dd3fc;
  border: 1px solid var(--accent-info);
}

.risk-bajo {
  background-color: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border: 1px solid var(--accent-success);
}

.guide-step {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 1.25rem;
  border-radius: var(--border-radius-md);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-hover));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.step-content {
  font-size: 0.95rem;
}

.step-content h4 {
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.step-content p {
  color: var(--text-secondary);
}

.legal-basis-box {
  background: rgba(139, 92, 246, 0.03);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.legal-basis-title {
  font-weight: 600;
  color: #c084fc;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Document Generator Styles */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2.5rem;
}

.document-preview-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.document-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.document-preview {
  background-color: white;
  color: #1e293b;
  padding: 3.5rem 3rem;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  font-family: 'Courier New', Courier, monospace;
  font-size: 10pt;
  line-height: 1.6;
  flex-grow: 1;
  min-height: 500px;
  max-height: 650px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Legal Library Accordion */
.accordion-item {
  border: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.2);
  border-radius: var(--border-radius-md);
  margin-bottom: 1rem;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.accordion-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  background: rgba(30, 41, 59, 0.4);
  transition: var(--transition-smooth);
}

.accordion-header:hover {
  background: rgba(30, 41, 59, 0.6);
}

.accordion-content {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0, 1, 0, 1), padding 0.3s ease-out;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.accordion-item.open {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: var(--shadow-md);
}

.accordion-item.open .accordion-header {
  background: rgba(139, 92, 246, 0.05);
  color: var(--text-primary);
}

.accordion-item.open .accordion-content {
  padding: 1.5rem;
  max-height: 2000px; /* High enough to contain content */
  overflow: visible;
  border-top: 1px solid var(--border-color);
}

.accordion-arrow {
  transition: var(--transition-smooth);
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.legal-article-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
}

.legal-article-card strong {
  color: var(--accent-info);
}

/* Case Tracker Grid */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  position: relative;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.case-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.15);
}

.case-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.case-worker-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.case-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.case-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.case-details-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  padding-bottom: 0.25rem;
}

.case-details-label {
  color: var(--text-muted);
}

.case-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.case-actions .btn {
  flex-grow: 1;
  padding: 0.5rem;
  font-size: 0.85rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-success);
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 1000;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Dashboard Grid */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.color-primary { color: var(--accent-primary); }
.stat-value.color-success { color: var(--accent-success); }
.stat-value.color-warning { color: var(--accent-warning); }
.stat-value.color-danger { color: var(--accent-danger); }

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive adjustments */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 1.5rem;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .nav-item {
    padding: 0.75rem 1rem;
    flex-shrink: 0;
  }
  .nav-item.active {
    border-left: none;
    border-bottom: 3px solid var(--accent-primary);
  }
  .main-content {
    width: 100%;
    padding: 1.5rem;
  }
  .split-layout {
    grid-template-columns: 1fr;
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 500px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out forwards;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

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

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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