:root {
  /* webcoffee.io Brand Colors */
  --primary: #004E73;
  --primary-dark: #003B5C;
  --primary-light: #0066A1;
  --accent: #FF8C00;
  --accent-dark: #E67E00;
  --accent-light: #FFA500;
  
  /* Grayscale */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Status Colors */
  --success: #10b981;
  --success-dark: #059669;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --info: var(--primary);
  
  /* Layout */
  --radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

* {
  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(--gray-900);
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  min-height: 100vh;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Navbar */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  padding: 1rem 0;
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 50px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.brand-main {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--gray-600);
  letter-spacing: 0.05em;
  font-weight: 500;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links span {
  color: var(--gray-700);
  font-weight: 500;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
  color: white;
  box-shadow: var(--shadow);
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--danger-dark) 0%, var(--danger) 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.btn-block {
  width: 100%;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 0;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--accent);
}

.page-header h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.project-card {
  background: white;
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: all 0.3s ease;
  border-top: 3px solid var(--primary);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-top-color: var(--accent);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.project-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.status {
  padding: 0.25rem 0.75rem;
  border-radius: calc(var(--radius) * 0.75);
  font-size: 0.8125rem;
  font-weight: 600;
}

.status.active {
  background: #d1fae5;
  color: var(--success-dark);
}

.status.inactive {
  background: #fee2e2;
  color: var(--danger-dark);
}

.project-info {
  margin: 1rem 0;
  color: var(--gray-700);
  font-size: 0.9375rem;
}

.project-info p {
  margin: 0.5rem 0;
}

.project-info strong {
  color: var(--primary);
  font-weight: 600;
}

.api-key {
  background: var(--gray-100);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--accent-dark);
  border: 1px solid var(--gray-300);
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}

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

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.9375rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 78, 115, 0.1);
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
  background: white;
  border-radius: calc(var(--radius) * 2);
  box-shadow: var(--shadow-xl);
  padding: 3rem;
  width: 100%;
  max-width: 450px;
  border-top: 4px solid var(--accent);
}

.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo img {
  max-width: 250px;
  height: auto;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.alert-danger {
  background: #fee2e2;
  color: var(--danger-dark);
  border-left: 4px solid var(--danger);
}

.alert-success {
  background: #d1fae5;
  color: var(--success-dark);
  border-left: 4px solid var(--success);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  font-weight: 600;
  text-align: left;
  padding: 1rem;
  font-size: 0.9375rem;
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9375rem;
}

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

tr:hover {
  background: var(--gray-50);
}

code {
  background: var(--gray-100);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--accent-dark);
}

/* Responsive */
@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .logo {
    height: 40px;
  }
  
  .brand-main {
    font-size: 1rem;
  }
  
  .brand-sub {
    font-size: 0.7rem;
  }
  
  .nav-links {
    flex-direction: column;
    width: 100%;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
  }
  
  .login-card {
    padding: 2rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  
  .project-actions {
    flex-direction: column;
  }
  
  .project-actions .btn {
    width: 100%;
  }
}

/* Enhanced Project Card Styles */
.project-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--gray-100);
  gap: 1rem;
}

.project-header h3 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

.status {
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) * 1.5);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.status.active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.status.inactive {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  color: white;
}

.project-info {
  margin: 0 0 1.5rem 0;
  flex: 1;
}

.project-info p {
  margin: 0.75rem 0;
  color: var(--gray-700);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.project-info strong {
  color: var(--primary);
  font-weight: 700;
  display: inline-block;
  min-width: 80px;
}

.api-key {
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.8125rem;
  color: var(--primary-dark);
  border: 1px solid var(--gray-300);
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.project-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.625rem;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 2px solid var(--gray-100);
}

.project-actions .btn {
  width: 100%;
  justify-content: center;
  font-size: 0.8125rem;
  padding: 0.625rem 0.75rem;
  white-space: nowrap;
}

.project-actions form {
  display: contents;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: calc(var(--radius) * 2);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  border-top: 4px solid var(--danger);
}

.modal-content h3 {
  color: var(--danger);
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: flex-end;
}

.modal-actions .btn {
  min-width: 120px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
  
  .project-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .project-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .status {
    align-self: flex-start;
  }
  
  .api-key {
    display: block;
    max-width: 100%;
  }
  
  .project-actions {
    grid-template-columns: 1fr;
  }
}

/* Modern Form Styles */
.form-container {
  background: white;
  border-radius: calc(var(--radius) * 1.5);
  padding: 2rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
  max-width: 900px;
}

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

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9375rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 78, 115, 0.1);
}

.form-group small {
  display: block;
  margin-top: 0.5rem;
  color: var(--gray-600);
  font-size: 0.875rem;
}

.form-group h3 {
  color: var(--primary);
  font-size: 1.125rem;
  margin: 2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.api-key-display {
  display: block;
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  padding: 1rem;
  border-radius: var(--radius);
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875rem;
  color: var(--primary-dark);
  border: 2px solid var(--primary);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--gray-200);
}

/* Templates Page Styles */
.templates-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 2rem 0 1.5rem 0;
  border-bottom: 2px solid var(--gray-200);
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  background: transparent;
  color: var(--gray-600);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
}

.tab-btn:hover {
  color: var(--primary);
  background: var(--gray-50);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.templates-list {
  display: grid;
  gap: 1rem;
}

.template-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
  transition: all 0.3s ease;
}

.template-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

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

.template-header h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1.25rem;
}

.template-header div {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.375rem 0.875rem;
  border-radius: calc(var(--radius) * 1.5);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.badge-body {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
}

.badge-footer {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: white;
}

.badge-default {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: white;
}

.template-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gray-200);
}

.template-actions form {
  display: inline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .form-container {
    padding: 1.5rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions .btn {
    width: 100%;
  }
  
  .templates-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .template-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
