/* Luxurious Professional - Olive Green Pastel */
:root {
  --bg-main: #f8f9f7;
  --bg-surface: #ffffff;
  --border: #e3e8e0;
  --text: #2a3428;
  --text-muted: #6b7565;
  --primary: #8a9b7a;
  --primary-hover: #7a8b6a;
  --secondary: #b4c4a8;
  --tertiary: #d4dcc8;
  --success: #7da67f;
  --error: #c57a7a;
  --warning: #d4b896;
  --info: #8fa8b4;
}

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

html {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-main);
  letter-spacing: -0.01em;
}

body {
  overflow-x: hidden;
}

/* Navbar */
.navbar {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 90%, white));
  color: white;
  padding: 12px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  max-width: none;
  margin: 0 12px;
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo {
  font-size: 28px;
}

.nav-menu {
  display: flex;
  gap: 6px;
}

.nav-btn {
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  letter-spacing: -0.01em;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

.nav-btn.active {
  background: rgba(255,255,255,0.3);
}

/* Main Layout */
.main-container {
  display: flex;
  max-width: 1800px;
  margin: 0 auto;
  min-height: calc(100vh - 56px);
}

/* AI Sidebar Right */
.ai-sidebar-right {
  width: 360px;
  background: white;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 56px;
  height: calc(100vh - 56px);
  z-index: 50;
}

.ai-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fafbfa 0%, #ffffff 100%);
}

.ai-icon {
  font-size: 24px;
}

.ai-header h3 {
  font-size: 16px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.ai-chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-message {
  padding: 10px 14px;
  border-radius: 8px;
  max-width: 90%;
  animation: slideIn 0.3s ease-out;
  font-size: 13px;
  line-height: 1.5;
}

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

.ai-message.user {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 95%, white));
  color: white;
  align-self: flex-end;
  margin-left: auto;
}

.ai-message.assistant {
  background: var(--bg-main);
  color: var(--text);
  align-self: flex-start;
  border: 1px solid var(--border);
}

.ai-message.assistant h1,
.ai-message.assistant h2,
.ai-message.assistant h3 {
  margin-top: 10px;
  margin-bottom: 6px;
}

.ai-message.assistant h1 { font-size: 16px; }
.ai-message.assistant h2 { font-size: 14px; }
.ai-message.assistant h3 { font-size: 13px; }

.ai-message.assistant ul,
.ai-message.assistant ol {
  margin-left: 18px;
  margin-top: 6px;
  margin-bottom: 6px;
}

.ai-message.assistant code {
  background: #eef1ed;
  padding: 2px 5px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.ai-message.assistant pre {
  background: var(--text);
  color: #e8ebe7;
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 6px 0;
}

.ai-message.assistant pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.ai-input-container {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: white;
}

#ai-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

#ai-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(138,155,122,0.1);
}

.btn-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 95%, white));
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.btn-icon:hover {
  transform: scale(1.05);
}

.ai-suggestions {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-main);
}

.suggestion-btn {
  background: white;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  transition: all 0.15s;
  color: var(--text-muted);
}

.suggestion-btn:hover {
  background: #f3f5f2;
  border-color: var(--primary);
  transform: translateX(4px);
}

/* Content Area */
.content {
  flex: 1;
  padding: 24px;
  padding-right: 384px;
  overflow-y: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-header h1 {
  font-size: 26px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.15s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(138,155,122,0.1);
}

.stat-icon {
  font-size: 40px;
  opacity: 0.9;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}

/* Card */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.card h3 {
  font-size: 16px;
  margin-bottom: 14px;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 95%, white));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(138,155,122,0.2);
}

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

.btn-secondary:hover {
  background: var(--bg-main);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), color-mix(in srgb, var(--success) 95%, white));
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--error), color-mix(in srgb, var(--error) 95%, white));
  color: white;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Search & Filter Bars */
.search-bar,
.filter-bar {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
}

.search-bar input,
.filter-bar input,
.filter-bar select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  background: white;
}

.search-bar input {
  flex: 1;
}

.search-bar input:focus,
.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(138,155,122,0.1);
}

/* Table Container */
.table-container {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

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

th {
  background: var(--bg-main);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
}

tbody tr.table-row {
  cursor: pointer;
  transition: all 0.15s;
}

tbody tr.table-row:hover {
  background: var(--bg-main);
}

tbody tr.table-row.active {
  background: rgba(138,155,122,0.08);
  border-left: 3px solid var(--primary);
}

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

/* Badge */
.badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: rgba(125,166,127,0.15);
  color: #4a6b4c;
}

.badge-warning {
  background: rgba(212,184,150,0.15);
  color: #8b7350;
}

.badge-danger {
  background: rgba(197,122,122,0.15);
  color: #8b4a4a;
}

.badge-info {
  background: rgba(143,168,180,0.15);
  color: #4a6270;
}

.badge-secondary {
  background: rgba(180,196,168,0.15);
  color: #5a6b52;
}

/* List Container */
.list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  padding: 14px;
  background: var(--bg-main);
  border-radius: 6px;
  border-left: 3px solid var(--primary);
  transition: all 0.15s;
}

.list-item:hover {
  background: #f0f3ef;
  transform: translateX(4px);
}

.list-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.list-item-title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

.list-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.list-item-content {
  font-size: 13px;
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 14px;
  margin-bottom: 20px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}

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

.modal {
  background: white;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.3s ease-out;
}

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

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

.modal-header h2 {
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
}

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Form */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text);
  font-size: 12px;
  letter-spacing: -0.01em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(138,155,122,0.1);
}

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

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

/* Action Buttons in Tables */
.action-buttons {
  display: flex;
  gap: 6px;
}

.action-btn {
  padding: 5px 10px;
  font-size: 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}

.action-btn-view {
  background: rgba(143,168,180,0.15);
  color: #4a6270;
}

.action-btn-view:hover {
  background: rgba(143,168,180,0.25);
}

.action-btn-edit {
  background: rgba(212,184,150,0.15);
  color: #8b7350;
}

.action-btn-edit:hover {
  background: rgba(212,184,150,0.25);
}

.action-btn-delete {
  background: rgba(197,122,122,0.15);
  color: #8b4a4a;
}

.action-btn-delete:hover {
  background: rgba(197,122,122,0.25);
}

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  padding: 20px;
}

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

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  font-size: 64px;
  display: block;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 32px;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.login-form {
  margin-bottom: 24px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 14px;
  margin-top: 8px;
}

.login-error {
  margin-top: 12px;
  padding: 10px;
  background: rgba(197,122,122,0.1);
  border: 1px solid rgba(197,122,122,0.3);
  border-radius: 6px;
  color: var(--error);
  font-size: 13px;
  display: none;
}

.login-error.show {
  display: block;
}

.login-demo-info {
  padding: 16px;
  background: var(--bg-main);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.8;
}

/* Nav User */
.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-username {
  color: white;
  font-size: 13px;
  font-weight: 500;
}

/* Table Row Actions - Toolbar */
.table-row-toolbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 500;
  animation: slideUpToolbar 0.3s ease-out;
}

@keyframes slideUpToolbar {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.table-row-toolbar.show {
  display: flex;
}

.toolbar-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

/* Responsive */
@media (max-width: 1200px) {
  .ai-sidebar {
    width: 300px;
  }
}

@media (max-width: 968px) {
  .main-container {
    flex-direction: column;
  }
  
  .ai-sidebar-right {
    width: 100%;
    height: 380px;
    position: relative;
    top: 0;
    right: 0;
  }
  
  .content {
    padding-right: 24px;
  }
  
  .nav-menu {
    flex-wrap: wrap;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Loading */
.loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(138,155,122,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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