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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  background-image:
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.1) 0px, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1rem;
}

/* Glassmorphism Card */
.auth-card {
  margin: auto;
  background: var(--card-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  animation: fadeIn 0.5s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-align: center;
  letter-spacing: -0.025em;
}

.subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 0rem;
  font-size: 0.875rem;
}

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

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: var(--text-primary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #000;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-google {
  background-color: white;
  color: #374151;
  margin-top: 1rem;
}

.btn-google:hover {
  background-color: #f9fafb;
}

.divider {
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-primary);
  font-size: 0.75rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--input-border);
}

.divider:not(:empty)::before {
  margin-right: 0.75rem;
}

.divider:not(:empty)::after {
  margin-left: 0.75rem;
}

#error-message {
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 1rem;
  text-align: center;
  min-height: 1.25rem;
}

/* Dashboard styles */
.dashboard-container {
  max-width: 1000px;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  margin-bottom: 2rem;
}



.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--input-border);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

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


/* Icones (mask-image per tenyir de color) */
.icon {
  display: inline-block;
  width: 48px;
  height: 48px;
  background-color: var(--color-primary);
  mask-repeat: no-repeat;
  mask-size: contain;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  -webkit-mask-position: center;
}


/* Modals & UI Helpers extrets (No més inline-styles) */

.header-controls {
  display: flex;
  gap: 1rem;
}

.main-header {
  text-align: center;
  margin-bottom: 1rem;
  margin-top: 1rem;
}

.btn-icon {
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}


.templates-container {
  margin-top: 1rem;
  border-top: 1px solid var(--input-border);
  padding-top: 1rem;
}

.loading-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.new-template-btn {
  margin-top: 1rem;
  text-decoration: none;
}

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

.custom-perfil-modal {
  background-color: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--input-border);
}

.custom-perfil-modal .modal-header {
  border-bottom: 1px solid var(--input-border);
}

.perfil-title {
  color: var(--primary-color);
}

.modal-close-dark {
  color: var(--text-primary);
}

.perfil-body {
  padding: 1.5rem;
}

.loading-state-text {
  text-align: center;
  color: var(--text-secondary);
}

.hidden-form {
  display: none;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.integration-container {
  text-align: center;
}

.form-feedback {
  text-align: center;
  margin-top: 1rem;
  min-height: 1.25rem;
  margin-bottom: 1rem;
}

.error-feedback {
  color: var(--error-color);
}

.success-feedback {
  color: var(--success-color);
}

.margin-top-md {
  margin-top: 1rem;
}

.margin-top-0 {
  margin-top: 0 !important;
}

.margin-right-sm {
  margin-right: 8px;
}

.btn-danger {
  width: 100%;
  border-color: var(--error-color);
  color: var(--error-color);
}

.auth-footer {
  margin-bottom: 0;
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  width: 100%;
  flex-wrap: nowrap;
}

.auth-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  text-align: center;
  line-height: 1.2;
}

.footer-sep {
  color: white;
  opacity: 0.4;
  font-size: 0.5rem;
  user-select: none;
}

@media (max-width: 600px) {
  .auth-footer {
    gap: 0.5rem;
    padding: 1rem 0.5rem;
  }

  .auth-footer a {
    max-width: 85px;
    font-size: 0.7rem;
  }
}

.auth-footer a:hover {
  color: var(--text-primary);
}