/* FractalCut V2 - Custom Brand Styles with Dark Mode Support */

/* Alpine.js x-cloak */
[x-cloak] { display: none !important; }

:root {
  /* Franco Group Branding */
  --franco-red: #991b1b;
  --franco-red-dark: #7f1d1d;
  --franco-red-light: #b91c1c;

  /* Secondary Colors */
  --slate-dark: #1e293b;
  --slate-light: #334155;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--franco-red) 0%, var(--franco-red-dark) 100%);
  --gradient-secondary: linear-gradient(135deg, var(--slate-dark) 0%, var(--slate-light) 100%);
}

/* Dark mode color scheme */
.dark {
  color-scheme: dark;
}

/* Brand-specific overrides - Simplified */
.btn-brand-primary {
  background: var(--gradient-primary);
  transition: all 0.2s ease;
}

.btn-brand-primary:hover {
  box-shadow: 0 4px 12px rgba(153, 27, 27, 0.25);
}

.brand-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tab styling */
.tab-button {
  position: relative;
  padding: 0 1rem;
  height: 48px;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: #64748b;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.dark .tab-button {
  color: #94a3b8;
}

.tab-button:hover {
  color: var(--franco-red);
  background: rgba(153, 27, 27, 0.05);
}

.dark .tab-button:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.tab-button.active {
  color: var(--franco-red);
  border-bottom-color: var(--franco-red);
}

.dark .tab-button.active {
  color: #ef4444;
  border-bottom-color: #ef4444;
}

/* Hide scrollbar on tab navigation */
.sticky.top-14::-webkit-scrollbar {
  display: none;
}

/* Card hover effects - Simplified */
.card-hover {
  transition: box-shadow 0.2s ease;
}

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

.dark .card-hover:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Stats cards - Clean & Simple with Dark Mode */
.stat-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #991b1b;
  transition: all 0.2s ease;
}

.dark .stat-card {
  background: #1e293b;
  border-color: #475569;
  border-left-color: #ef4444;
}

.stat-card:hover {
  border-left-width: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark .stat-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.stat-card .text-gray-600 {
  color: #64748b;
}

.dark .stat-card .text-gray-600 {
  color: #94a3b8;
}

.stat-card .text-gray-900 {
  color: #1e293b;
}

.dark .stat-card .text-gray-900 {
  color: #f1f5f9;
}

/* Loading spinner */
.spinner {
  border: 4px solid #e5e7eb;
  border-top-color: var(--franco-red);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.dark .spinner {
  border-color: #475569;
  border-top-color: #ef4444;
}

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

/* Canvas visualization */
.canvas-container {
  position: relative;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  background: white;
}

.dark .canvas-container {
  border-color: #475569;
  background: #1e293b;
}

.canvas-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.canvas-control-btn {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark .canvas-control-btn {
  background: #334155;
  border-color: #475569;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.canvas-control-btn:hover {
  background: #f9fafb;
  border-color: var(--franco-red);
}

.dark .canvas-control-btn:hover {
  background: #475569;
  border-color: #ef4444;
}

/* Sidebar with Dark Mode */
.sidebar {
  background: white;
  border-right: 1px solid #cbd5e1;
  padding: 1.5rem;
  overflow-y: auto;
}

.dark .sidebar {
  background: #1e293b;
  border-color: #475569;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.dark .sidebar-section h3 {
  color: #94a3b8;
}

/* Form improvements with Dark Mode */
.form-input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: all 0.2s;
  width: 100%;
  background: white;
  color: #1e293b;
}

.dark .form-input {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

.form-input:focus {
  outline: none;
  border-color: var(--franco-red);
  box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.1);
}

.dark .form-input:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #334155;
  font-size: 0.875rem;
}

.dark .form-label {
  color: #cbd5e1;
}

/* Table improvements with Dark Mode */
.modern-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
}

.dark .modern-table {
  border-color: #475569;
}

.modern-table th {
  background: #991b1b;
  color: white;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #7f1d1d;
}

.dark .modern-table th {
  background: #7f1d1d;
  border-bottom-color: #991b1b;
}

.modern-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #cbd5e1;
  font-size: 0.875rem;
  color: #1e293b;
  background: #ffffff;
}

.dark .modern-table td {
  border-bottom-color: #475569;
  color: #f1f5f9;
  background: #1e293b;
}

.modern-table tbody tr {
  transition: background-color 0.15s ease;
}

.modern-table tbody tr:hover td {
  background: #f8fafc;
}

.dark .modern-table tbody tr:hover td {
  background: #334155;
}

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

/* Badges with Dark Mode */
.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.dark .badge-success {
  background: #064e3b;
  color: #6ee7b7;
}

.badge-warning {
  background: #fef3c7;
  color: #78350f;
}

.dark .badge-warning {
  background: #78350f;
  color: #fcd34d;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.dark .badge-danger {
  background: #7f1d1d;
  color: #fca5a5;
}

.badge-primary {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.dark .badge-primary {
  background: #7f1d1d;
  color: #fca5a5;
  border-color: #991b1b;
}

/* Animations */
@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.animate-slide-in {
  animation: slideInFromRight 0.3s ease-out;
}

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

/* Responsive utilities */
@media (max-width: 1024px) {
  .sidebar {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }

  .dark .sidebar {
    border-bottom-color: #475569;
  }
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Better focus states */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  ring-offset: 2px;
}

/* Improved button hover effects */
button {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:active {
  transform: scale(0.98);
}

/* Card shadows on hover - Subtle */
.shadow-sm:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dark .shadow-sm:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Gradient text effect */
.gradient-text {
  background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Loading pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth transitions */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Improved scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

::-webkit-scrollbar-thumb:hover {
  background: #991b1b;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #ef4444;
}

/* Better input focus */
input:focus,
select:focus,
textarea:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(153, 27, 27, 0.15);
}

.dark input:focus,
.dark select:focus,
.dark textarea:focus {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* Checkbox improvements */
input[type="checkbox"]:checked {
  background-color: #991b1b;
  border-color: #991b1b;
}

.dark input[type="checkbox"]:checked {
  background-color: #ef4444;
  border-color: #ef4444;
}

/* Modal backdrop blur */
.backdrop-blur {
  backdrop-filter: blur(4px);
}

/* Success state */
.success-glow {
  box-shadow: 0 0 20px rgba(5, 150, 105, 0.4);
}

/* Error state */
.error-shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Tooltip style (for future use) */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 0.5rem;
}

.dark [data-tooltip]:hover::after {
  background: #f1f5f9;
  color: #1e293b;
}

/* Print optimizations */
@media print {
  .no-print {
    display: none !important;
  }

  nav,
  button,
  .sidebar {
    display: none !important;
  }
}

/* Dark mode body backgrounds */
.dark body {
  background: #0f172a;
  color: #f1f5f9;
}

/* Select and Input Dark Mode Support */
.dark select {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #475569;
}

.dark input {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #475569;
}

.dark textarea {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #475569;
}

/* Settings sidebar dark mode */
.dark .bg-white.rounded-xl.shadow-sm.p-6 {
  background: #1e293b;
  color: #f1f5f9;
}

/* Text color utilities for dark mode */
.dark .text-gray-900 {
  color: #f1f5f9;
}

.dark .text-gray-600 {
  color: #94a3b8;
}

.dark .text-gray-500 {
  color: #94a3b8;
}

/* All white backgrounds in dark mode */
.dark div[class*="bg-white"] {
  background: #1e293b;
}

/* Dark mode for gray backgrounds */
.dark .bg-gray-50 {
  background: #334155;
}

.dark .bg-gray-100 {
  background: #475569;
}

.dark .bg-gray-200 {
  background: #64748b;
}

/* Border colors in dark mode */
.dark .border-gray-200 {
  border-color: #475569;
}

.dark .border-gray-300 {
  border-color: #475569;
}

.dark .border-gray-400 {
  border-color: #64748b;
}

/* Hover states in dark mode */
.dark .hover\:bg-gray-50:hover {
  background: #334155;
}

.dark .hover\:bg-gray-100:hover {
  background: #475569;
}

.dark .hover\:bg-gray-200:hover {
  background: #64748b;
}

/* Focus states in dark mode */
.dark .focus\:border-gray-400:focus {
  border-color: #64748b;
}

.dark .focus\:ring-gray-500:focus {
  --tw-ring-color: #64748b;
}