@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  /* --- Clean Modern Blue Palette --- */
  /* Neutral / Surface */
  --color-bg-body: #F1F5F9;      /* Slate-100 - Clean light gray background */
  --color-bg-card: #FFFFFF;      /* White - Surface */
  --color-bg-sidebar: #FFFFFF;   /* White - Sidebar */
  
  /* Text Colors */
  --color-text-primary: #0F172A;   /* Slate-900 - Deep, high contrast */
  --color-text-secondary: #475569; /* Slate-600 - Muted but readable */
  --color-text-tertiary: #94A3B8;  /* Slate-400 - Placeholders/Icons */
  
  /* Brand Colors - NO VIOLET/INDIGO */
  --color-primary: #0EA5E9;        /* Sky-500 - Vibrant, accessible blue */
  --color-primary-hover: #0284C7;  /* Sky-600 - Darker blue for hover */
  --color-primary-light: #E0F2FE;  /* Sky-100 - Backgrounds/Tints */
  
  /* Accents & Status */
  --color-accent: #14B8A6;         /* Teal-500 - Secondary action / Success */
  --color-accent-hover: #0D9488;   /* Teal-600 */
  --color-danger: #EF4444;         /* Red-500 - Error */
  --color-warning: #F59E0B;        /* Amber-500 - Warning */
  
  /* Borders & Shadows */
  --color-border: #E2E8F0;         /* Slate-200 - Subtle borders */
  --color-border-focus: #38BDF8;   /* Sky-400 - Focus ring */
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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-soft: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.01); /* Super clean shadow */

  /* Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --sidebar-width: 260px;
  --header-height: 80px;
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  
  --z-index-modal: 1000;
  --z-index-dropdown: 100;
  --z-index-header: 50;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background-color: var(--color-bg-body);
  color: var(--color-text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Layout Structure --- */
body.auth-page {
  overflow: hidden; /* Only lock scroll on auth page if strictly needed */
}

/* Auth Container */
#auth-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background-color: var(--color-bg-card);
}

.auth-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  background-color: var(--color-bg-card);
  max-width: 50%;
  position: relative;
  z-index: 2;
}

.auth-header {
  width: 100%;
  max-width: 400px;
  margin-bottom: 32px;
  text-align: center;
}

.logo-icon-auth {
  margin-bottom: 24px;
  display: flex;
  justify-content: center;
}

.logo-icon-auth svg {
  width: 64px;
  height: 64px;
  color: var(--color-text-primary); /* Dark Navy */
}

.auth-header h2 {
  font-size: 30px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 12px 0;
  letter-spacing: -0.5px;
}

.auth-header p {
  color: var(--color-text-secondary);
  font-size: 16px;
  margin: 0;
}

.auth-visuals {
  flex: 1;
  background-color: #0F172A; /* Keep dark navy for contrast */
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Geometric details - Adjusted colors to remove purples/violets */
.shape { position: absolute; }

.shape-1 { /* Large Circle */
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
  opacity: 0.2;
  top: -100px; right: -100px;
  border-radius: 50%;
  z-index: 1;
}

.shape-2 { /* Square pattern */
  width: 300px; height: 300px;
  background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  top: 50px; right: 50px;
  opacity: 0.5;
  z-index: 1;
}

.shape-3 { /* Triangle */
  width: 0; height: 0;
  border-left: 80px solid transparent;
  border-right: 80px solid transparent;
  border-bottom: 150px solid var(--color-accent);
  top: 20%; left: 10%;
  transform: rotate(-15deg);
  opacity: 0.8;
  z-index: 2;
}

.shape-4 { /* Star/Burst - Amber */
  width: 100px; height: 100px;
  background-color: var(--color-warning);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  top: 60%; right: 20%;
  animation: float 6s ease-in-out infinite;
  z-index: 3;
}

.shape-5 { /* Semi-Circle */
  width: 250px; height: 125px;
  background-color: #0369A1; /* Sky-700 */
  border-radius: 125px 125px 0 0;
  bottom: 0; left: 15%;
  z-index: 2;
}

.shape-6 { /* Ring */
  width: 300px; height: 300px;
  border: 4px solid var(--color-primary-hover);
  border-radius: 50%;
  top: 10%; left: 30%;
  opacity: 0.15;
}

.decorative-line {
  position: absolute;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
  top: 55%; left: 0;
  opacity: 0.3;
}

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

/* Main App Layout */
#card-generator-container {
  display: flex;
  height: 100vh;
  overflow: hidden; /* App-like structure */
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 0 8px;
}

.logo-icon svg {
  color: var(--color-primary);
  width: 32px;
  height: 32px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--color-text-primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: all 0.2s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.nav-item:hover {
  background-color: var(--color-bg-body);
  color: var(--color-primary);
}

.nav-item.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary-hover);
  font-weight: 600;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-spacer { flex: 1; }

/* --- Main Content Area --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg-body);
  position: relative;
  overflow: hidden;
}

.top-header {
  height: var(--header-height);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  flex-shrink: 0;
}

.header-title h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.5px;
}

.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 40px 40px 40px;
}

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

.section-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

/* --- Cards & Forms --- */
.card {
  background-color: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); /* Start subtle */
  padding: 32px;
  border: 1px solid var(--color-border);
  transition: box-shadow 0.3s ease;
}

/* .card:hover { box-shadow: var(--shadow-md); } Optional hover effect */

.form-card {
  max-width: 900px; /* Slightly wider for modern feel */
  margin: 0 auto; /* Center it */
}

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

.row-group {
  display: flex;
  gap: 24px;
}

.row-group .form-group { flex: 1; }

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 8px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%; /* Ensure full width */
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--color-text-primary);
  background-color: var(--color-bg-card);
  transition: all 0.2s ease;
  line-height: normal; /* Fix alignment */
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15); /* Sky Blue ring */
}

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

/* Autocomplete Container */
.autocomplete {
  position: relative;
  width: 100%;
}

.dropdown-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.dropdown-icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.autocomplete-items {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-index-dropdown);
  max-height: 250px;
  overflow-y: auto;
}

.autocomplete-items div {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-primary);
  transition: background 0.1s;
}

.autocomplete-items div:hover {
  background-color: var(--color-bg-body);
}

.autocomplete-active {
  background-color: var(--color-primary-light) !important;
  color: var(--color-primary-hover) !important;
}

/* Buttons */
.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 32px;
}

#generate-btn {
  background-color: var(--color-primary);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

#generate-btn:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

#generate-btn:active {
  transform: translateY(0);
}

/* Status & Loader */
#status-area {
  margin-top: 40px;
  text-align: center;
  padding: 32px;
  background-color: var(--color-bg-body);
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
  display: none; /* JS toggles this */
}

.loader {
  border: 3px solid rgba(14, 165, 233, 0.2);
  border-top: 3px solid var(--color-primary);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.status-message {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 16px;
  margin-bottom: 24px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--color-accent);
  color: white;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.download-btn:hover {
  background-color: var(--color-accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* --- Responsive Design (Mobile First principles applied via Media Queries) --- */

@media (max-width: 1024px) {
  /* Tablet Styles */
  .auth-content { max-width: 100%; padding: 40px; }
  .auth-visuals { display: none; } /* Hide heavy visuals on tablet/mobile auth */
  
  .sidebar {
    width: 80px; /* Collapsed sidebar */
    padding: 24px 12px;
  }
  
  .logo-text, .nav-item span:not(.nav-icon) {
    display: none; /* Hide text, keep icons */
  }
  
  .logo-container { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; }
  
  .content-scroll { padding: 0 24px 24px; }
  .top-header { padding: 0 24px; }
}

@media (max-width: 768px) {
  /* Mobile Styles */
  :root {
    --header-height: 64px;
  }

  /* Reset Layout to Column */
  #card-generator-container {
    flex-direction: column;
    height: 100vh; /* Keep full height */
    overflow: hidden; 
  }

  .sidebar { /* Move to bottom or hamburger? Let's try bottom nav style or simple top bar */
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--color-border);
    order: 2; /* Move to bottom */
    padding: 12px;
    justify-content: space-around;
    align-items: center;
    background-color: var(--color-bg-card);
    z-index: var(--z-index-header);
    position: relative; 
  }
  
  .logo-container { display: none; } /* Hide logo in bottom nav */
  
  .sidebar-nav {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    gap: 0;
  }
  
  .nav-item {
    padding: 8px 16px;
    flex-direction: column;
    gap: 4px;
    font-size: 10px; /* Tiny label */
    border-radius: 8px;
  }
  
  .nav-item span:not(.nav-icon) {
    display: block; /* Show text again for bottom nav */
  }

  /* Main Content adjustments */
  .main-content {
    order: 1; /* Move to top */
    height: calc(100vh - 70px); /* Subtract approx bottom nav height */
  }
  
  .top-header {
    background-color: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    justify-content: center;
    height: 60px;
  }
  
  .top-header h1 { font-size: 18px; }
  
  .content-scroll {
    padding: 20px 16px; /* Smaller padding */
  }
  
  .card {
    padding: 20px;
    border-radius: var(--radius-md);
  }
  
  .row-group {
    flex-direction: column; /* Stack form inputs */
    gap: 0;
  }
  
  .form-group { margin-bottom: 16px; }
  
  .auth-content { padding: 24px; }
  .auth-header { text-align: center; } 
  #sign-in { justify-content: center; }
}

/* --- Status Specifics --- */
.status-success { color: var(--color-accent); }
.status-error { color: var(--color-danger); }

/* --- Clerk UI Override (Minimal) --- */
.cl-rootBox { width: 100%; display: flex; justify-content: center; }
.cl-card { 
  box-shadow: none !important; 
  background: transparent !important;
}
.cl-formButtonPrimary {
  background-color: var(--color-primary) !important;
}
/* --- Profile Page Styles --- */
.profile-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
}

.profile-info h1 {
  margin: 0 0 4px 0;
  font-size: 24px;
  color: var(--color-text-primary);
  font-weight: 600;
}

.profile-info p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.profile-actions {
  display: flex;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  justify-content: flex-end;
}

.btn {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-secondary:hover {
  background-color: #E2E8F0; /* Slate-200 */
}

.btn-danger {
  background-color: #FEF2F2; /* Red-50 */
  color: var(--color-danger);
  border: 1px solid #FECACA; /* Red-200 */
}

.btn-danger:hover {
  background-color: #FEE2E2; /* Red-100 */
  border-color: #FCA5A5;
}
