/* ============================================
   VALINOR - STRIPE-INSPIRED DARK THEME
   ============================================ */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #16161f;
  --bg-card-hover: #1a1a25;
  --bg-input: #1e1e2a;
  
  /* Accent colors */
  --accent-purple: #7c3aed;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-pink: #ec4899;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #3b82f6 50%, #06b6d4 100%);
  --gradient-button: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  --gradient-glow: linear-gradient(135deg, rgba(124, 58, 237, 0.4) 0%, rgba(59, 130, 246, 0.4) 100%);
  
  /* Text */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);
  
  /* Borders */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(124, 58, 237, 0.15);
  --shadow-glow-hover: 0 0 60px rgba(124, 58, 237, 0.25);
  
  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Background gradient effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 40%),
    radial-gradient(ellipse 60% 40% at 10% 80%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--accent-cyan);
}

/* Page Layout */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shell {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.content {
  padding: 40px 0;
}

/* ============================================
   HEADER
   ============================================ */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.brand-link {
  text-decoration: none;
}

.brand-title {
  font-size: 24px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-button);
  color: white;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px rgba(124, 58, 237, 0.4);
  color: white;
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-glow);
}

.card h2, .card h3 {
  color: var(--text-primary);
  margin-bottom: 16px;
}

.card h2 {
  font-size: 20px;
  font-weight: 600;
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select,
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  outline: none;
}

input:focus,
textarea:focus,
select:focus,
.form-select:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* ============================================
   DROP ZONE
   ============================================ */
.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent-purple);
  background: rgba(124, 58, 237, 0.05);
  box-shadow: var(--shadow-glow);
}

.drop-zone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--gradient-button);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

/* ============================================
   LAYOUT
   ============================================ */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.layout-wide {
  max-width: 1000px;
  margin: 0 auto;
}

/* ============================================
   PROJECTS GRID
   ============================================ */
.projects-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.2s ease;
}

.project-card:hover {
  border-color: var(--accent-purple);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.project-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.project-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* ============================================
   BADGES & PILLS
   ============================================ */
.badge-soft {
  display: inline-flex;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent-purple);
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 20px;
  background: var(--gradient-button);
  color: white;
  transition: all 0.2s ease;
}

.pill-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  color: white;
}

.pill-link .dot {
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
}

.quality-badge {
  display: inline-flex;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(6, 182, 212, 0.2) 100%);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown {
  position: relative;
}

.dropdown-toggle {
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 100;
}

.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 12px 16px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */
.lang-switcher {
  display: flex;
  gap: 4px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--border-color);
}

.lang-btn {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.lang-btn:hover {
  color: var(--text-primary);
}

.lang-btn.active {
  background: #a78bfa;
  color: white;
}

/* ============================================
   FLASH MESSAGES
   ============================================ */
.flash {
  padding: 16px 20px;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border: 1px solid rgba(124, 58, 237, 0.3);
  color: var(--text-primary);
  font-size: 14px;
}

.flash.error {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  font-weight: 500;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.muted { color: var(--text-muted); }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card:hover {
  border-color: var(--accent-purple);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-hover);
}

.feature-card.highlight {
  border-color: var(--accent-purple);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.feature-icon {
  font-size: 40px;
  margin-bottom: 20px;
}

.feature-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--gradient-button);
  color: white;
  border-radius: 20px;
}

/* ============================================
   ANALYSIS RESULTS
   ============================================ */
.analysis-section {
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
}

.analysis-section:last-child {
  border-bottom: none;
}

.analysis-section h4 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.quality-score-box {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.quality-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.quality-icon {
  font-size: 32px;
}

.quality-bar-container {
  position: relative;
}

.quality-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.quality-indicator {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #a78bfa;
  border-radius: 50%;
  top: -2px;
  transform: translateX(-50%);
  box-shadow: 0 0 15px #a78bfa, 0 0 30px rgba(167, 139, 250, 0.5);
}

.quality-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.recommendation-box {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-weight: 500;
}

.rec-firmare,
.rec-sign {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(6, 182, 212, 0.15) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--accent-green);
}

.rec-negoziare,
.rec-negotiate {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(234, 88, 12, 0.15) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.rec-rifiutare,
.rec-reject {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.15) 100%);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.issues-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.issues-list li:last-child {
  border-bottom: none;
}

/* ============================================
   CHAT INTERFACE
   ============================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 500px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.chat-message {
  margin-bottom: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  max-width: 85%;
}

.chat-message.user {
  background: var(--gradient-button);
  margin-left: auto;
  color: white;
}

.chat-message.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.chat-input-area {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.chat-input-area input {
  flex: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1024px) {
  .shell {
    padding: 0 16px;
  }

  .layout {
    gap: 20px;
  }

  .card {
    padding: 20px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 0 12px;
  }

  .content {
    padding: 20px 0;
  }

  /* Header Mobile */
  header {
    flex-direction: column;
    gap: 12px;
    padding: 16px 0;
  }

  nav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .nav-desktop {
    display: none;
  }

  .nav-mobile {
    display: flex;
  }

  .lang-switcher {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    order: -1;
    width: 100%;
    justify-content: center;
    margin-bottom: 8px;
  }

  /* Hamburger Menu */
  .hamburger-menu {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 1000;
    padding: 20px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .hamburger-menu.open {
    transform: translateX(0);
  }

  .hamburger-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
  }

  .hamburger-menu nav {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .hamburger-menu .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }

  .hamburger-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
  }

  .hamburger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
  }

  .hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .hamburger-btn.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  /* Dropdown Mobile */
  .dropdown-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 80px;
  }

  /* Buttons Mobile */
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .btn-sm-mobile {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Cards Mobile */
  .card {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .card h2 {
    font-size: 18px;
  }

  /* Forms Mobile */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  textarea,
  select {
    padding: 14px 16px;
    font-size: 16px; /* Previene zoom su iOS */
  }

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

  /* Drop Zone Mobile */
  .drop-zone {
    padding: 32px 20px;
  }

  .drop-zone-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }

  /* Features Grid Mobile */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .feature-card {
    padding: 24px;
  }

  /* Projects Grid Mobile */
  .project-card {
    padding: 16px;
  }

  .project-meta {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  /* Analysis Mobile */
  .quality-score-box {
    padding: 16px;
  }

  .quality-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Chat Mobile */
  .chat-container {
    height: 400px;
  }

  .chat-message {
    max-width: 90%;
    padding: 12px 14px;
  }

  .chat-input-area {
    flex-direction: column;
    gap: 10px;
  }

  .chat-input-area .btn {
    width: 100%;
  }

  /* Footer Mobile */
  footer {
    padding: 20px 12px;
    font-size: 12px;
  }

  /* Utility classes for mobile */
  .hide-mobile {
    display: none !important;
  }

  .show-mobile {
    display: block !important;
  }

  .text-center-mobile {
    text-align: center !important;
  }

  .stack-mobile {
    flex-direction: column !important;
  }

  .full-width-mobile {
    width: 100% !important;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .shell {
    padding: 0 10px;
  }

  .brand-title {
    font-size: 20px;
  }

  .card {
    padding: 14px;
  }

  .btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  .feature-card {
    padding: 18px;
  }

  .feature-icon {
    font-size: 32px;
  }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
  .btn,
  .dropdown-toggle,
  .lang-btn,
  input[type="file"],
  .mail-tab-btn,
  .room-tab {
    min-height: 44px;
    min-width: 44px;
  }

  a, button {
    -webkit-tap-highlight-color: rgba(124, 58, 237, 0.2);
  }
}

/* Safe area for notch devices */
@supports (padding: env(safe-area-inset-bottom)) {
  footer {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .hamburger-menu {
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}
