/* TED Design System - Brand tokens for The Engineer's Desk product suite */

:root {
  /* Brand Colors - Aviation-industrial craft theme */
  --ted-navy: #1B3A4B;
  --ted-muted: #50575e;
  --ted-border: #c5c8ce;
  --ted-gold: #C4A35A;
  
  /* Surface Colors */
  --ted-surface: #F7F5F1;
  --ted-card: #FFFFFF;
  
  /* Text Colors */
  --ted-text-primary: #1A1A1A;
  --ted-text-secondary: #50575e;
  --ted-text-on-navy: #FFFFFF;
  --ted-text-on-gold: #1B3A4B;
  
  /* Shadow */
  --ted-shadow: 0 2px 8px rgba(27, 58, 75, 0.08);
  --ted-shadow-hover: 0 4px 16px rgba(27, 58, 75, 0.12);
  
  /* Border Radius */
  --ted-radius: 8px;
  --ted-radius-lg: 12px;
  
  /* Status Colors */
  --ted-success: #10b981;
  --ted-warning: #f59e0b;
  --ted-error: #ef4444;
  
  /* Utility Colors */
  --ted-gray-50: #f9fafb;
  --ted-gray-100: #f3f4f6;
  --ted-gray-200: #e5e7eb;
  --ted-gray-300: #d1d5db;
  --ted-gray-400: #9ca3af;
  --ted-gray-500: #6b7280;
  --ted-gray-600: #4b5563;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--ted-surface);
  color: var(--ted-text-primary);
  line-height: 1.5;
}

/* Layout */
.ted-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.ted-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App Shell - Header */
.ted-header {
  background-color: var(--ted-navy);
  color: var(--ted-text-on-navy);
  padding: 1.5rem 0;
  box-shadow: var(--ted-shadow);
  position: relative;
  z-index: 100;
}

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

.ted-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--ted-text-on-navy);
}

.ted-tagline {
  font-size: 0.875rem;
  color: var(--ted-gold);
  opacity: 0.95;
  margin-top: 0.25rem;
}

.ted-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Main Content */
.ted-main {
  flex: 1;
  padding: 2rem 0;
}

/* Cards */
.ted-card {
  background: var(--ted-card);
  border-radius: var(--ted-radius);
  box-shadow: var(--ted-shadow);
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}

.ted-card:hover {
  box-shadow: var(--ted-shadow-hover);
}

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

.ted-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ted-navy);
  margin: 0;
}

/* Buttons */
.ted-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--ted-radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.ted-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ted-btn-primary {
  background-color: var(--ted-gold);
  color: var(--ted-text-on-gold);
}

.ted-btn-primary:hover:not(:disabled) {
  background-color: #B08D45;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(196, 163, 90, 0.3);
}

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

.ted-btn-secondary:hover:not(:disabled) {
  background-color: var(--ted-surface);
  border-color: var(--ted-navy);
}

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

.ted-btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

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

.ted-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--ted-navy);
  font-size: 0.875rem;
}

.ted-input,
.ted-select,
.ted-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--ted-border);
  border-radius: var(--ted-radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--ted-text-primary);
  background: var(--ted-card);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ted-input:focus,
.ted-select:focus,
.ted-textarea:focus {
  outline: none;
  border-color: var(--ted-gold);
  box-shadow: 0 0 0 3px rgba(196, 163, 90, 0.1);
}

.ted-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Login/Auth Pages */
.ted-login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--ted-surface);
  padding: 1rem;
}

.ted-login-card {
  background: var(--ted-card);
  border-radius: var(--ted-radius-lg);
  box-shadow: var(--ted-shadow-hover);
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
}

.ted-login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.ted-login-title {
  color: var(--ted-navy);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.ted-login-subtitle {
  color: var(--ted-gold);
  font-size: 0.875rem;
}

/* Tables */
.ted-table {
  width: 100%;
  border-collapse: collapse;
}

.ted-table th {
  text-align: left;
  padding: 0.75rem;
  color: var(--ted-navy);
  font-weight: 600;
  border-bottom: 2px solid var(--ted-border);
}

.ted-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--ted-border);
}

.ted-table tr:hover {
  background-color: var(--ted-surface);
}

/* Badges */
.ted-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ted-badge-primary {
  background-color: var(--ted-navy);
  color: var(--ted-text-on-navy);
}

.ted-badge-gold {
  background-color: var(--ted-gold);
  color: var(--ted-text-on-gold);
}

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

.ted-badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

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

/* Messages & Alerts */
.ted-message {
  padding: 1rem;
  border-radius: var(--ted-radius);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ted-message-error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid var(--ted-error);
}

.ted-message-success {
  background-color: #d1fae5;
  color: #065f46;
  border-left: 4px solid var(--ted-success);
}

.ted-message-warning {
  background-color: #fef3c7;
  color: #92400e;
  border-left: 4px solid var(--ted-warning);
}

.ted-message-info {
  background-color: #e0e7ff;
  color: #3730a3;
  border-left: 4px solid var(--ted-navy);
}

/* Loading States */
.ted-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--ted-muted);
  font-size: 1.125rem;
}

.ted-loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--ted-surface);
  color: var(--ted-navy);
  font-size: 1.25rem;
}

.ted-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(27, 58, 75, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  z-index: 10000;
}

/* Empty States */
.ted-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--ted-muted);
}

.ted-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.ted-empty-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--ted-text-primary);
}

.ted-empty-text {
  font-size: 0.875rem;
  color: var(--ted-muted);
}

/* Modal */
.ted-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(27, 58, 75, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.ted-modal {
  background-color: var(--ted-card);
  border-radius: var(--ted-radius-lg);
  padding: 2rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(27, 58, 75, 0.15);
}

.ted-modal-header {
  margin-bottom: 1.5rem;
}

.ted-modal-title {
  color: var(--ted-navy);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.ted-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* User Info Badge */
.ted-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--ted-radius);
}

.ted-user-email {
  font-size: 0.875rem;
  color: var(--ted-text-on-navy);
}

/* Utility Classes */
.ted-text-center { text-align: center; }
.ted-text-right { text-align: right; }
.ted-font-bold { font-weight: 700; }
.ted-font-semibold { font-weight: 600; }
.ted-text-sm { font-size: 0.875rem; }
.ted-text-xs { font-size: 0.75rem; }
.ted-text-lg { font-size: 1.125rem; }
.ted-text-xl { font-size: 1.25rem; }

.ted-mt-1 { margin-top: 0.5rem; }
.ted-mt-2 { margin-top: 1rem; }
.ted-mt-4 { margin-top: 2rem; }
.ted-mb-1 { margin-bottom: 0.5rem; }
.ted-mb-2 { margin-bottom: 1rem; }
.ted-mb-4 { margin-bottom: 2rem; }

.ted-flex { display: flex; }
.ted-flex-col { flex-direction: column; }
.ted-items-center { align-items: center; }
.ted-justify-between { justify-content: space-between; }
.ted-gap-1 { gap: 0.5rem; }
.ted-gap-2 { gap: 1rem; }
.ted-gap-3 { gap: 1.5rem; }

.ted-grid { display: grid; }
.ted-grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.ted-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Mobile Responsive */
@media (max-width: 768px) {
  .ted-header {
    padding: 1rem 0;
  }
  
  .ted-header h1 {
    font-size: 1.25rem;
  }
  
  .ted-header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .ted-main {
    padding: 1rem 0;
  }
  
  .ted-container {
    padding: 0 1rem;
  }
  
  .ted-card {
    padding: 1rem;
  }
  
  .ted-btn {
    width: 100%;
    justify-content: center;
  }
  
  .ted-modal {
    padding: 1.5rem;
  }
  
  .ted-modal-actions {
    flex-direction: column-reverse;
  }
  
  .ted-grid-cols-2,
  .ted-grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

/* Link styling for TED theme */
a.ted-link {
  color: var(--ted-navy);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

a.ted-link:hover {
  color: var(--ted-gold);
}

/* Premium craft aesthetic - clean but NOT generic SaaS */
.ted-premium-surface {
  background: linear-gradient(135deg, var(--ted-surface) 0%, #f9f7f4 100%);
  border: 1px solid var(--ted-border);
}

.ted-craft-accent {
  background: linear-gradient(135deg, var(--ted-navy) 0%, #2a5468 100%);
  box-shadow: 0 4px 12px rgba(27, 58, 75, 0.2);
}
