// frontend/public/css/styles.css
/* General Styles */
:root {
  --primary-color: #4f46e5;
  --secondary-color: #9333ea;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --dark-color: #1f2937;
  --light-color: #f3f4f6;
  --text-color: #374151;
  --border-color: #e5e7eb;
  --sidebar-width: 260px;
  --header-height: 64px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  color: var(--text-color);
  background-color: #f9fafb;
  margin: 0;
  padding: 0;
}

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

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--dark-color);
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  transition: all 0.3s;
}

.sidebar-collapsed {
  width: 70px;
}

.sidebar-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header img {
  max-height: 40px;
}

.sidebar-menu {
  padding: 1rem 0;
}

.sidebar-menu-item {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-menu-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-menu-item.active {
  background-color: var(--primary-color);
  color: white;
}

.sidebar-menu-item i {
  margin-right: 1rem;
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-collapsed .sidebar-menu-item span {
  display: none;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  transition: all 0.3s;
}

.main-content-expanded {
  margin-left: 70px;
}

.header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  background-color: white;
  position: sticky;
  top: 0;
  z-index: 990;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.user-menu {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 0.5rem;
}

.main-content-inner {
  padding: 1.5rem;
}

/* Flow Designer Styles */
.flow-designer-container {
  height: calc(100vh - var(--header-height) - 2px);
  display: flex;
}

.flow-designer-sidebar {
  width: 300px;
  border-right: 1px solid var(--border-color);
  background-color: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flow-designer-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.flow-designer-sidebar-content {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.flow-designer-main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.flow-designer-toolbar {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background-color: white;
  display: flex;
  align-items: center;
}

.flow-designer-canvas {
  height: calc(100% - 50px);
  background-color: #f9fafb;
  background-image: radial-gradient(#e5e7eb 1px, transparent 1px);
  background-size: 20px 20px;
}

.flow-node {
  padding: 10px;
  border-radius: 5px;
  background: white;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  width: 180px;
}

.flow-node-header {
  font-weight: 500;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 5px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}

.flow-node-header i {
  margin-right: 5px;
}

.flow-node-content {
  font-size: 0.875rem;
}

.node-item {
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: move;
  background-color: white;
  transition: all 0.2s;
}

.node-item:hover {
  background-color: var(--light-color);
}

.node-item-icon {
  margin-right: 0.5rem;
}

/* Form Styles */
.form-section {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-color);
  background-color: white;
  background-clip: padding-box;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
  border-color: var(--primary-color);
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(79, 70, 229, 0.25);
}

.btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 0.25rem;
  transition: all 0.15s ease-in-out;
}

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

.btn-primary:hover {
  background-color: #4338ca;
  border-color: #4338ca;
}

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

.btn-secondary:hover {
  background-color: #7e22ce;
  border-color: #7e22ce;
}

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

.btn-success:hover {
  background-color: #059669;
  border-color: #059669;
}

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

.btn-warning:hover {
  background-color: #d97706;
  border-color: #d97706;
}

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

.btn-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

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

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Card Styles */
.card {
  background-color: white;
  border-radius: 0.375rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

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

.card-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background-color: #f9fafb;
}

/* Table Styles */
.table {
  width: 100%;
  margin-bottom: 1rem;
  color: var(--text-color);
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  vertical-align: top;
  border-top: 1px solid var(--border-color);
}

.table thead th {
  vertical-align: bottom;
  border-bottom: 2px solid var(--border-color);
  font-weight: 500;
  text-align: left;
}

.table tbody + tbody {
  border-top: 2px solid var(--border-color);
}

.table-hover tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

/* Alert Styles */
.alert {
  position: relative;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
}

.alert-success {
  color: #0f766e;
  background-color: #d1fae5;
  border-color: #6ee7b7;
}

.alert-warning {
  color: #92400e;
  background-color: #fef3c7;
  border-color: #fcd34d;
}

.alert-danger {
  color: #991b1b;
  background-color: #fee2e2;
  border-color: #fca5a5;
}

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

/* Modal Styles */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  width: 500px;
  max-width: 95%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.modal-title {
  font-size: 1.125rem;
  font-weight: 500;
  margin: 0;
}

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

.modal-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

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

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 0;
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    width: var(--sidebar-width);
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .flow-designer-sidebar {
    width: 100%;
    position: fixed;
    height: 100%;
    transform: translateX(-100%);
    transition: all 0.3s;
    z-index: 995;
  }
  
  .flow-designer-sidebar.open {
    transform: translateX(0);
  }
}
