/**
 * COTIZADOR PREMIUM - Style Architecture
 *
 * 1. Variables & Root
 * 2. Base & Resets
 * 3. Layout - Header & Navigation
 * 4. Forms & Inputs
 * 5. Builder - Content Sections
 * 6. Buttons & Actions
 * 7. Modals & Editors
 * 8. View Specifics (Quotes, Clients, etc.)
 * 9. Animations & Media Queries
 */

/* 1. Variables & Root */
:root {
  --primary: #000000;
  --primary-dark: #1a1a1a;
  --secondary: #2a2a2a;
  --accent: #000000;
  --dark: #ffffff;
  --dark-light: #f5f5f5;
  --dark-lighter: #e5e5e5;
  --text: #000000;
  --text-secondary: #4a4a4a;
  --border: #d0d0d0;
  --success: #000000;
  --gradient-primary: linear-gradient(135deg, #000000 0%, #2a2a2a 100%);
  --gradient-dark: linear-gradient(135deg, #f5f5f5 0%, #ffffff 100%);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* 2. Base & Resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--dark);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* App Header Section */
/* 3. Layout - Header & Navigation */
.app-header-section {
  padding: 2rem;
  background: var(--dark);
  border: 1px solid var(--border);
}

.app-header-content {
  display: flex;
  align-items: center;
  gap: 3rem;
  max-width: 1000px;
  margin: 0 auto;
}

.app-logo-horizontal {
  width: 300px;
  height: auto;
  flex-shrink: 0;
}

.app-header-text {
  flex: 1;
}

.app-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.app-description {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1;
}

/* Header */
.header {
  text-align: center;
  padding: 3rem 0 4rem;
  position: relative;
}

.header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.logo-image {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 0.5rem;
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Section */
.section {
  background: var(--dark-light);
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.title-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
}

/* 4. Forms & Inputs */
/* Form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.input-with-select {
  width: 100%;
}

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

textarea {
  resize: vertical;
  font-family: inherit;
}

/* 5. Builder - Content Sections */
/* Items Section */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn-add-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-add-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

.btn-add-item svg {
  width: 20px;
  height: 20px;
}

/* Items Container */
.items-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.item-card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  transition: all 0.3s ease;
}

.item-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.item-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.item-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(14, 165, 233, 0.1);
}

.btn-icon.delete:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.item-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.item-description p {
  margin: 0.5rem 0;
}

.item-description strong {
  color: var(--text);
}

.item-details {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.item-detail {
  display: flex;
  flex-direction: column;
}

.item-detail-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.item-detail-value {
  color: var(--text);
  font-weight: 600;
}

/* Totals */
.totals-container {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  color: var(--text-secondary);
}

.total-row span:last-child {
  font-weight: 600;
  color: var(--text);
  font-family: "Courier New", monospace;
}

.tax-row {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.final-total {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.5rem;
}

.final-total span:last-child {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 6. Buttons & Actions */
/* Actions Section */
.actions-section {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1rem 0;
}

.btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn svg {
  width: 20px;
  height: 20px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

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

.btn-secondary:hover {
  background: var(--dark-lighter);
  border-color: var(--primary);
}

.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: calc(50% - 10px);
  left: calc(50% - 10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

.btn-secondary.loading::after {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--primary);
}

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

/* Modal */
/* 7. Modals & Editors */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--dark-light);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--gradient-dark);
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-close:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.form-grid-modal {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

#itemDescriptionEditor {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 200px;
}

.ql-toolbar.ql-snow {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
}

.ql-container.ql-snow {
  background: var(--dark);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
}

.ql-editor {
  min-height: 150px;
  color: var(--text);
}

.ql-snow .ql-stroke {
  stroke: var(--text-secondary);
}

.ql-snow .ql-fill {
  fill: var(--text-secondary);
}

.ql-snow .ql-picker-label {
  color: var(--text-secondary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--dark);
}

/* Preview Content */
.preview-content {
  background: #ffffff;
  color: #000000;
  padding: 2.5rem;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  max-width: 210mm;
  margin: 0 auto;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e5e5;
  page-break-inside: avoid;
}

.preview-logo img {
  display: block;
  max-width: 200px;
  height: auto;
}

.preview-quote-info {
  text-align: right;
}

.preview-quote-info h3 {
  font-size: 1.25rem;
  color: #000000;
  margin-bottom: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.preview-quote-info p {
  color: #4a4a4a;
  font-size: 0.875rem;
}

.preview-client-info {
  margin-bottom: 2.5rem;
  padding: 0;
  background: transparent;
  border-radius: 0;
  page-break-inside: avoid;
}

.preview-client-info h3 {
  color: #000000;
  margin-bottom: 0.875rem;
  font-size: 1rem;
  font-weight: 700;
}

.preview-client-info p {
  color: #2a2a2a;
  margin: 0.4rem 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.preview-client-info strong {
  color: #000000;
  font-weight: 600;
}

.preview-items {
  margin-bottom: 2rem;
}

.preview-items h3 {
  color: #000000;
  margin-bottom: 1.25rem;
  font-size: 1rem;
  font-weight: 700;
}

.preview-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e5e5;
  page-break-inside: avoid;
}

.preview-item:last-child {
  border-bottom: none;
}

.preview-item h4 {
  color: #000000;
  margin-bottom: 0.625rem;
  font-size: 1rem;
  font-weight: 600;
}

.preview-item-description {
  color: #2a2a2a;
  margin-bottom: 0.875rem;
  line-height: 1.6;
  font-size: 0.875rem;
}

.preview-item-details {
  display: flex;
  gap: 1.5rem;
  color: #4a4a4a;
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.preview-item-details strong {
  color: #000000;
  font-weight: 600;
}

.preview-totals {
  margin-top: 3rem;
  padding: 1.5rem;
  background: #f9fafb;
  border-radius: 8px;
  border: none;
  page-break-inside: avoid;
}

.preview-total-row {
  display: flex;
  justify-content: space-between;
  margin: 0.4rem 0;
  color: #2a2a2a;
  font-size: 0.9rem;
}

.preview-total-row.final {
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid #e5e5e5;
  font-size: 1.25rem;
  font-weight: 700;
  color: #000000;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .app-header-content {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }

  .app-logo-horizontal {
    width: 100%;
    max-width: 300px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .section {
    padding: 1.5rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid-modal {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .actions-section {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .preview-header {
    flex-direction: column;
    gap: 1rem;
  }

  .preview-quote-info {
    text-align: left;
  }

  .modal-content {
    max-height: 95vh;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.1rem;
}
/* Notifications */
.notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  background: var(--dark-light);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

.notification.active {
  transform: translateY(0);
  opacity: 1;
}

.notification.success {
  border-left: 4px solid #10b981;
}

.notification.error {
  border-left: 4px solid #ef4444;
}

/* Loading States */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.loading * {
  visibility: hidden !important;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-top: -10px;
  margin-left: -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

.btn-secondary.loading::after {
  border-top-color: var(--primary);
}

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

/* Navigation */
.app-nav {
  background: var(--dark-light);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1100;
}

.menu-toggle svg {
  width: 28px;
  height: 28px;
}

.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1050;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nav-overlay.active {
  display: block;
  opacity: 1;
}

.nav-logo img {
  height: 35px;
}

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

.nav-link {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--dark-lighter);
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary);
  color: white;
}

.nav-mobile-user {
  display: none;
}

/* Tabs */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* Management Tables/Lists */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.data-table th, .data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.data-table th.sortable:hover {
  background: var(--dark-lighter);
  color: var(--primary);
}

.data-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.catalog-card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.catalog-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.mobile-list {
  display: none; /* Hidden on desktop by default */
}

/* Utils */
.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.item-actions-header {
  display: flex;
  gap: 0.75rem;
}

.actions-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Updated Loading State */
.btn-primary.loading, .btn-secondary.loading, .btn-icon.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-primary.loading::after, .btn-secondary.loading::after, .btn-icon.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: calc(50% - 8px);
  left: calc(50% - 8px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.6s linear infinite;
}

.btn-secondary.loading::after, .btn-icon.loading::after {
  border-top-color: var(--primary);
}

.btn-icon.loading svg {
  visibility: hidden;
}

/* Section Loaders */
.section-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary);
  gap: 1rem;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 8. View Specifics (Quotes, Clients, etc.) */
/* Authentication */
.app-guest {
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-wrapper {
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  animation: fadeIn 0.4s ease-out;
}

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

.login-box {
  padding: 4rem 3rem;
  text-align: center;
}

.login-box .header::after {
  height: 2px;
  width: 60px;
}

.login-box .form-group {
  text-align: left;
}

.login-box .error-message {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fffafa;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 500;
}

/* User Profile in Nav */
.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-left: 1.5rem;
  margin-left: 1.5rem;
  border-left: 1px solid var(--border);
}

.nav-user .username {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
}

.nav-user .username:hover {
  opacity: 0.7;
}

#logoutBtn {
  color: var(--text-secondary);
}

#logoutBtn:hover {
  color: #b91c1c;
}

/* 9. Animations & Media Queries */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

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

/* Resp */
@media (max-width: 768px) {
  /* Premium Navigation */
  .menu-toggle {
    display: flex;
    position: relative;
    background: transparent;
    border: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2100;
    color: var(--text);
    padding: 0.5rem;
  }

  .menu-toggle.active .icon-menu {
    display: none;
  }

  .menu-toggle.active .icon-close {
    display: block !important;
  }

  .menu-toggle svg {
    width: 28px;
    height: 28px;
    transition: all 0.3s ease;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    gap: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
  }

  .nav-links.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
  }

  .nav-link {
    width: auto;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    opacity: 0;
    color: var(--text-secondary);
    transform: translateY(20px);
    border-radius: 12px;
    transition: all 0.3s ease;
  }

  .nav-link.active {
    color: var(--primary) !important;
    background: rgba(0, 0, 0, 0.05) !important;
  }

  .nav-links.active .nav-link {
    animation: staggerIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }

  /* Staggered Delays */
  .nav-link:nth-child(1) { animation-delay: 0.1s; }
  .nav-link:nth-child(2) { animation-delay: 0.15s; }
  .nav-link:nth-child(3) { animation-delay: 0.2s; }
  .nav-link:nth-child(4) { animation-delay: 0.25s; }
  .nav-link:nth-child(5) { animation-delay: 0.3s; }

  .nav-overlay {
    display: none !important; /* Managed by .nav-links fullscreen now */
  }

  .container {
    padding: 1rem 0.75rem; /* Minimal native-like padding */
  }

  .section {
    padding: 1.25rem;
    border-radius: 0; /* Edge-to-edge feel on sections */
    border-left: none;
    border-right: none;
    box-shadow: none;
    background: transparent;
  }

  .section::before {
    display: none; /* Remove desktop-only top border */
  }

  /* Full-Width Header Controls */
  .section-header {
    margin-bottom: 2rem;
  }

  .section-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .actions-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .actions-container input,
  .actions-container select,
  .actions-container .btn {
    width: 100% !important; /* Force full width on all header controls */
    max-width: none !important;
    margin: 0 !important;
    height: 50px; /* Native-friendly touch target */
    font-size: 1rem;
  }

  /* List Items Native Polish */
  .mobile-list {
    gap: 0.5rem;
  }

  .mobile-list-item {
    border-left: none;
    border-right: none;
    border-radius: 0;
    background: var(--dark);
    margin: 0 -0.75rem; /* Negative margin to hit edges */
    padding: 1rem 1.25rem;
  }

  /* Immersive Fullscreen Modals */
  .modal {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
    background: var(--dark);
  }

  .modal-content {
    width: 100% !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none !important;
    display: flex;
    flex-direction: column;
    background: var(--dark);
  }

  .modal-header {
    padding: 1.25rem 1.5rem;
    background: var(--dark);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .modal-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--dark-light);
  }

  .modal-footer {
    padding: 1.25rem 1.5rem;
    background: var(--dark);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }

  /* Management visibility polish */
  .data-table {
    display: none;
  }

  .mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .mobile-list-item {
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: grid;
    grid-template-areas:
      "title status"
      "desc desc"
      "footer footer";
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
  }

  .mobile-list-item:active {
    transform: scale(0.98);
  }

  .mobile-list-title {
    grid-area: title;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-list-status {
    grid-area: status;
    justify-self: end;
  }

  .mobile-list-desc {
    grid-area: desc;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
  }

  .mobile-list-footer {
    grid-area: footer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
  }

  .mobile-list-price {
    font-weight: 800;
    font-family: var(--font-mono);
    font-size: 1rem;
  }

  .mobile-list-actions {
    display: flex;
    gap: 0.5rem;
  }

  /* Builder Section Adjustments */
  .section-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  /* Builder Specific Native Polish */
  .app-header-section {
    padding: 1.5rem 1.25rem;
    border: none;
    background: transparent;
  }

  .app-header-content {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

  .app-logo-horizontal {
    width: 200px;
  }

  /* Items Section Native */
  .item-actions-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
  }

  .item-card {
    border-left: none;
    border-right: none;
    border-radius: 0;
    margin: 0 -0.75rem;
    padding: 1.25rem;
    background: var(--dark);
  }

  .item-details {
    gap: 1.25rem;
  }

  /* Bottom Actions Native */
  .actions-section {
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100vw;
    margin: 2rem -0.75rem 0; /* Align with container bottom edges */
    padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom));
    background: var(--dark);
    border-top: 1px solid var(--border);
    flex-direction: column;
    gap: 0.75rem;
    z-index: 100;
  }

  .actions-section .btn {
    width: 100%;
    justify-content: center;
    height: 54px;
    font-size: 1.1rem;
  }

  /* New Header Polishing */
  .nav-container {
    height: 70px;
    padding: 0 1.25rem;
  }

  .desktop-only {
    display: none !important;
  }

  .nav-links:not(.active) {
     display: none;
  }

  .nav-mobile-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 3rem;
    width: 100%;
    padding-top: 2rem;
    border-top: 1px solid rgba(0,0,0,0.1);
    opacity: 0;
    transform: translateY(20px);
  }

  .nav-links.active .nav-mobile-user {
    animation: staggerIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.35s;
  }

  .nav-mobile-user .user-info {
    text-align: center;
  }

  .nav-mobile-user .username {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
  }

  .nav-mobile-user .user-role {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

  .btn-logout {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--dark-lighter);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    width: 100%;
    justify-content: center;
  }
}
