/* ================================================
   MOBILE APP REDESIGN - KRONOSFINANCE
   Diseño mobile-first para smartphone
   ================================================ */

/* ============================================
   1. VARIABLES Y RESET
   ============================================ */
:root {
  --primary-color: #667eea;
  --secondary-color: #764ba2;
  --accent-color: #f093fb;
  --dark-bg: #0f1419;
  --card-bg: #1a1f2e;
  --text-primary: #ffffff;
  --text-secondary: #a8b3cf;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --spacing: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================
   2. MOBILE-FIRST BASE STYLES
   ============================================ */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--dark-bg) 0%, #1a1f2e 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   3. LOGIN PAGE - MOBILE APP STYLE
   ============================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.login-form .form-group {
  margin-bottom: 20px;
}

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

.login-form input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.password-input-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 20px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.toggle-password:hover {
  opacity: 1;
}

.btn-login {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
  margin-top: 8px;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-message {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: #ff6b6b;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

/* ============================================
   4. DASHBOARD - MOBILE APP STYLE
   ============================================ */
.dashboard-container {
  min-height: 100vh;
  padding-bottom: 80px;
}

.dashboard-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-bg);
  padding: 12px 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-profile,
.btn-logout-dashboard {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
  border: 1px solid var(--border-color);
}

.btn-profile:active,
.btn-logout-dashboard:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.1);
}

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.app-logo {
  font-size: 28px;
  line-height: 1;
}

.header-brand h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.dashboard-subtitle {
  color: var(--text-secondary);
  font-size: 12px;
  margin: 4px 0 0;
  text-align: center;
  line-height: 1.3;
}

.session-info {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  margin: 6px 0 0;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  line-height: 1.4;
}

/* ============================================
   5. MÓDULOS GRID - MOBILE CARDS
   ============================================ */
.modules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
}

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

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  opacity: 0;
  transition: opacity 0.3s;
}

.module-card.active::before {
  opacity: 1;
}

.module-card:active {
  transform: scale(0.98);
}

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

.module-card.disabled:active {
  transform: none;
}

.module-icon {
  font-size: 48px;
  margin-bottom: 16px;
  text-align: center;
}

.module-card h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: var(--text-primary);
  text-align: center;
}

.module-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  text-align: center;
  line-height: 1.5;
}

.module-status {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

.module-card.active .module-status {
  background: rgba(102, 126, 234, 0.2);
  color: var(--primary-color);
}

.module-card.disabled .module-status {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

/* ============================================
   6. RESPONSIVE AJUSTES
   ============================================ */
@media (min-width: 768px) {
  .modules-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .modules-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1200px;
  }
}

/* ============================================
   7. ANIMACIONES Y TRANSICIONES
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.module-card {
  animation: fadeIn 0.4s ease-out backwards;
}

.module-card:nth-child(1) { animation-delay: 0.05s; }
.module-card:nth-child(2) { animation-delay: 0.1s; }
.module-card:nth-child(3) { animation-delay: 0.15s; }
.module-card:nth-child(4) { animation-delay: 0.2s; }
.module-card:nth-child(5) { animation-delay: 0.25s; }
.module-card:nth-child(6) { animation-delay: 0.3s; }

/* ============================================
   8. UTILIDADES TOUCH Y MOBILE
   ============================================ */
.touch-feedback {
  -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
}

/* Scroll suave */
html {
  scroll-behavior: smooth;
}

/* Eliminar scroll horizontal */
body, html {
  overflow-x: hidden;
  max-width: 100vw;
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
  
  .dashboard-header {
    padding-top: max(20px, env(safe-area-inset-top));
  }
  
  .dashboard-container {
    padding-bottom: max(80px, env(safe-area-inset-bottom));
  }
}
