/* assets/css/app.css — Calmecal Design System */

/* ── Google Fonts ────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Google+Sans:wght@400;500;700&family=Google+Sans+Display:wght@400;500;700&family=Roboto:wght@300;400;500&display=swap');

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* Primario — azul Google */
  --c-primary:        #1a73e8;
  --c-primary-dark:   #1557b0;
  --c-primary-light:  #e8f0fe;
  --c-primary-mid:    #4285f4;

  /* Secundario — verde Google */
  --c-secondary:      #34a853;
  --c-secondary-light:#e6f4ea;

  /* Superficies */
  --c-bg:             #f8f9fa;
  --c-surface:        #ffffff;
  --c-surface-2:      #f1f3f4;
  --c-border:         #dadce0;

  /* Texto */
  --c-text:           #202124;
  --c-text-2:         #5f6368;
  --c-text-3:         #80868b;

  /* Estados */
  --c-danger:         #ea4335;
  --c-warning:        #fbbc04;
  --c-success:        #34a853;
  --c-info:           #4285f4;

  /* Sombras */
  --shadow-sm:        0 1px 2px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.10);
  --shadow-md:        0 1px 3px rgba(60,64,67,.20), 0 4px 8px rgba(60,64,67,.10);
  --shadow-lg:        0 2px 6px rgba(60,64,67,.20), 0 8px 24px rgba(60,64,67,.12);

  /* Radios */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  24px;
  --r-xl:  32px;
  --r-full:9999px;

  /* Tipografía */
  --font-base:    'Roboto', sans-serif;
  --font-display: 'Google Sans Display', 'Google Sans', sans-serif;

  /* Animación */
  --ease:   cubic-bezier(.4,0,.2,1);
  --dur-s:  150ms;
  --dur-m:  250ms;
  --dur-l:  400ms;
}

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

html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-base);
  color:       var(--c-text);
  background:  var(--c-bg);
  line-height: 1.5;
  min-height:  100dvh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

button { cursor: pointer; font-family: inherit; }

input, textarea, select, button {
  font-family: inherit;
  font-size:   inherit;
}

/* ── Utilidades ──────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.text-center { text-align: center; }
.text-muted  { color: var(--c-text-2); }

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════ */

.login-root {
  min-height: 100dvh;
  display:    grid;
  grid-template-columns: 1fr;
  background: var(--c-bg);
}

@media (min-width: 860px) {
  .login-root {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Panel izquierdo (ilustración) ───────────────────────── */
.login-panel-left {
  display:         none;
  flex-direction:  column;
  justify-content: center;
  align-items:     center;
  padding:         48px;
  background:      linear-gradient(145deg, #1a73e8 0%, #0d47a1 60%, #4285f4 100%);
  position:        relative;
  overflow:        hidden;
}

@media (min-width: 860px) {
  .login-panel-left { display: flex; }
}

/* Orbes decorativos */
.login-panel-left::before,
.login-panel-left::after {
  content:       '';
  position:      absolute;
  border-radius: 50%;
  opacity:       .15;
}
.login-panel-left::before {
  width:  420px; height: 420px;
  top:   -80px; right: -100px;
  background: #fff;
}
.login-panel-left::after {
  width:  300px; height: 300px;
  bottom: -60px; left:   -80px;
  background: #4285f4;
  opacity: .3;
}

.login-brand {
  position:   relative;
  z-index:    1;
  text-align: center;
  color:      #fff;
}

.login-brand-logo {
  width:         72px;
  height:        72px;
  background:    rgba(255,255,255,.18);
  border:        2px solid rgba(255,255,255,.35);
  border-radius: var(--r-lg);
  display:       flex;
  align-items:   center;
  justify-content: center;
  margin:        0 auto 20px;
  font-size:     32px;
  backdrop-filter: blur(8px);
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size:   2.4rem;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-bottom: 8px;
}

.login-brand p {
  font-size:   1rem;
  opacity:     .85;
  max-width:   260px;
  line-height: 1.5;
}

.login-features {
  position:   relative;
  z-index:    1;
  margin-top: 48px;
  display:    flex;
  flex-direction: column;
  gap:        16px;
}

.login-feature {
  display:     flex;
  align-items: center;
  gap:         14px;
  color:       rgba(255,255,255,.92);
  font-size:   .9rem;
}

.login-feature-icon {
  width:           36px;
  height:          36px;
  flex-shrink:     0;
  background:      rgba(255,255,255,.15);
  border-radius:   var(--r-sm);
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       18px;
}

/* ── Panel derecho (formulario) ──────────────────────────── */
.login-panel-right {
  display:         flex;
  flex-direction:  column;
  justify-content: center;
  align-items:     center;
  padding:         32px 24px;
  min-height:      100dvh;
}

.login-card {
  width:         100%;
  max-width:     420px;
  background:    var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow:    var(--shadow-lg);
  padding:       40px 36px 36px;
  animation:     cardIn var(--dur-l) var(--ease) both;
}

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

/* Logo móvil (solo visible sin panel izquierdo) */
.login-mobile-brand {
  display:       flex;
  flex-direction:column;
  align-items:   center;
  margin-bottom: 28px;
}

@media (min-width: 860px) {
  .login-mobile-brand { display: none; }
}

.login-mobile-brand .brand-icon {
  width:           52px;
  height:          52px;
  background:      var(--c-primary);
  border-radius:   var(--r-md);
  display:         flex;
  align-items:     center;
  justify-content: center;
  color:           #fff;
  font-size:       26px;
  margin-bottom:   10px;
}

.login-mobile-brand .brand-name {
  font-family:  var(--font-display);
  font-size:    1.6rem;
  font-weight:  700;
  color:        var(--c-text);
}

/* Encabezado del card */
.login-card-header { margin-bottom: 28px; }

.login-card-header h2 {
  font-family:  var(--font-display);
  font-size:    1.5rem;
  font-weight:  600;
  color:        var(--c-text);
  margin-bottom:6px;
}

.login-card-header p {
  font-size:  .875rem;
  color:      var(--c-text-2);
}

/* ── Formulario ──────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display:       block;
  font-size:     .8rem;
  font-weight:   500;
  color:         var(--c-text-2);
  margin-bottom: 6px;
  letter-spacing:.3px;
  text-transform:uppercase;
}

.input-wrap {
  position:      relative;
  display:       flex;
  align-items:   center;
}

.input-icon {
  position:  absolute;
  left:      14px;
  color:     var(--c-text-3);
  font-size: 20px;
  pointer-events: none;
  transition: color var(--dur-s) var(--ease);
}

.form-input {
  width:          100%;
  height:         52px;
  padding:        0 14px 0 44px;
  border:         1.5px solid var(--c-border);
  border-radius:  var(--r-md);
  background:     var(--c-surface);
  color:          var(--c-text);
  font-size:      .95rem;
  transition:     border-color var(--dur-s) var(--ease),
                  box-shadow   var(--dur-s) var(--ease);
  outline:        none;
}

.form-input::placeholder { color: var(--c-text-3); }

.form-input:focus {
  border-color: var(--c-primary);
  box-shadow:   0 0 0 3px rgba(26,115,232,.15);
}

.form-input:focus + .input-icon,
.input-wrap:focus-within .input-icon {
  color: var(--c-primary);
}

.input-toggle {
  position:   absolute;
  right:      14px;
  background: none;
  border:     none;
  color:      var(--c-text-3);
  font-size:  20px;
  padding:    4px;
  border-radius: var(--r-sm);
  transition: color var(--dur-s) var(--ease);
}
.input-toggle:hover { color: var(--c-text); }

/* Error inline */
.form-error {
  display:    none;
  font-size:  .8rem;
  color:      var(--c-danger);
  margin-top: 5px;
  align-items:center;
  gap:        4px;
}
.form-error.visible { display: flex; }

/* Fila extras bajo password */
.form-extras {
  display:         flex;
  justify-content: space-between;
  align-items:     center;
  margin-bottom:   22px;
  gap:             8px;
  flex-wrap:       wrap;
}

.checkbox-label {
  display:     flex;
  align-items: center;
  gap:         8px;
  font-size:   .875rem;
  color:       var(--c-text-2);
  cursor:      pointer;
}

.checkbox-label input[type=checkbox] {
  width:         18px;
  height:        18px;
  accent-color:  var(--c-primary);
  border-radius: 4px;
  cursor:        pointer;
}

.link-sm {
  font-size:   .875rem;
  color:       var(--c-primary);
  font-weight: 500;
}

/* ── Botón primario ──────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  height:          52px;
  padding:         0 24px;
  border:          none;
  border-radius:   var(--r-md);
  font-size:       .95rem;
  font-weight:     500;
  transition:      background var(--dur-s) var(--ease),
                   box-shadow  var(--dur-s) var(--ease),
                   transform   var(--dur-s) var(--ease);
  cursor:          pointer;
}

.btn-primary {
  background: var(--c-primary);
  color:      #fff;
  width:      100%;
}
.btn-primary:hover  { background: var(--c-primary-dark); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .65; cursor: not-allowed; }

/* Estado de carga del botón */
.btn-primary.loading {
  pointer-events: none;
}
.btn-spinner {
  display:       none;
  width:         20px;
  height:        20px;
  border:        2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation:     spin .7s linear infinite;
}
.btn-primary.loading .btn-spinner  { display: block; }
.btn-primary.loading .btn-text     { display: none; }

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

/* ── Alert global ────────────────────────────────────────── */
.alert {
  display:       none;
  align-items:   flex-start;
  gap:           10px;
  padding:       14px 16px;
  border-radius: var(--r-md);
  font-size:     .875rem;
  margin-bottom: 18px;
  animation:     alertIn var(--dur-m) var(--ease);
}
.alert.visible { display: flex; }

@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-error   { background: #fce8e6; color: #c5221f; border-left: 3px solid var(--c-danger); }
.alert-success { background: var(--c-secondary-light); color: #137333; border-left: 3px solid var(--c-success); }
.alert-icon    { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ── Footer del card ─────────────────────────────────────── */
.login-card-footer {
  text-align:  center;
  margin-top:  24px;
  font-size:   .8rem;
  color:       var(--c-text-3);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE GENERAL (shared, se ampliará por módulo)
═══════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .login-card {
    padding:       28px 20px 24px;
    border-radius: var(--r-lg);
    box-shadow:    none;
    background:    transparent;
  }
  .login-panel-right { padding: 24px 16px; justify-content: flex-start; }
}
