/* ===== RESET & BASE STYLES ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  line-height: 1.6;
  margin: 0;
  overflow-x: hidden;
}

/* ===== CONTAINER ===== */
.container {
  width: 100%;
  max-width: 450px;
  position: relative;
  perspective: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ===== CARD STYLES ===== */
.card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 40px 35px;
  border-radius: 24px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  position: absolute;
  width: 100%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translateY(30px) rotateX(10deg);
  display: none;
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) translateY(0) rotateX(0);
}

/* ===== TYPOGRAPHY ===== */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 30px;
  color: #2d3748;
}

p.info {
  text-align: center;
  margin-bottom: 15px;
  color: #718096;
  font-weight: 500;
  font-size: 0.95rem;
}

/* ===== FORM ELEMENTS ===== */
label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
  color: #4a5568;
}

input, textarea {
  width: 100%;
  padding: 16px 20px;
  margin-bottom: 20px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  font-size: 1rem;
  font-weight: 400;
  background: rgba(255, 255, 255, 0.8);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
}

input:focus, textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 
    0 0 0 4px rgba(102, 126, 234, 0.1),
    0 4px 12px rgba(102, 126, 234, 0.15);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
}

input::placeholder, textarea::placeholder {
  color: #a0aec0;
  font-weight: 400;
}

/* ===== BUTTONS ===== */
.buttons {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}

button {
  flex: 1;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

button:active {
  transform: translateY(-1px);
}

/* ===== BUTTON COLORS ===== */
#go-signin { 
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
}

#go-signup { 
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

#signin-btn { 
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  width: 100%;
}

#signup-btn { 
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  width: 100%;
}

#signout-btn { 
  background: linear-gradient(135deg, #f56565, #e53e3e);
  color: white;
  width: 100%;
}

#view-profile { 
  background: linear-gradient(135deg, #4299e1, #3182ce);
  color: white;
}

#update-profile-btn { 
  background: linear-gradient(135deg, #ed8936, #dd6b20);
  color: white;
}

.back-btn, #back-to-connected { 
  background: linear-gradient(135deg, #a0aec0, #718096);
  color: white;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 480px) {
  body {
    padding: 10px;
    min-height: 100vh;
  }
  
  .container {
    max-width: 100%;
    width: 100%;
    padding: 0;
  }
  
  .card {
    padding: 30px 25px;
    border-radius: 20px;
    width: calc(100% - 20px);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) translateY(30px) rotateX(10deg);
  }
  
  .card.active {
    transform: translate(-50%, -50%) translateY(0) rotateX(0);
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .buttons {
    flex-direction: column;
    gap: 12px;
  }
  
  button {
    padding: 14px 20px;
  }
}

@media (max-width: 360px) {
  .card {
    padding: 25px 20px;
    width: calc(100% - 10px);
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  h2 {
    font-size: 1.3rem;
  }
}

/* ===== LOADING STATES ===== */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== HEADER SECTIONS ===== */
.welcome-header, .form-header, .success-header, .profile-header {
  text-align: center;
  margin-bottom: 30px;
}

.welcome-icon, .success-icon, .profile-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  display: block;
}

.welcome-icon {
  color: #667eea;
}

.success-icon {
  color: #48bb78;
}

.profile-icon {
  color: #4299e1;
}

.welcome-subtitle, .form-subtitle, .profile-subtitle {
  color: #718096;
  font-size: 0.95rem;
  margin-top: 5px;
}

.success-message {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 500;
}

/* ===== INFO SECTION ===== */
.info-section {
  background: rgba(102, 126, 234, 0.1);
  border-radius: 16px;
  padding: 20px;
  margin: 25px 0;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: #4a5568;
  font-weight: 500;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-item i {
  color: #667eea;
  width: 20px;
  text-align: center;
}

/* ===== FORM GROUPS ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 500;
  color: #4a5568;
}

.form-group label i {
  color: #667eea;
  width: 16px;
  text-align: center;
}

.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 25px;
}

/* ===== BUTTON ICONS ===== */
button i {
  margin-right: 8px;
  font-size: 0.9rem;
}

/* ===== SUCCESS/ERROR STATES ===== */
.error-message {
  background: linear-gradient(135deg, #f56565, #e53e3e);
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 500;
}

/* ===== LOADING ANIMATION ===== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading {
  animation: spin 1s linear infinite;
}

/* ===== ENHANCED FOCUS STATES ===== */
input:focus, textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 
    0 0 0 4px rgba(102, 126, 234, 0.1),
    0 4px 12px rgba(102, 126, 234, 0.15);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px);
}

/* ===== READ-ONLY STYLES ===== */
input[readonly], textarea[readonly] {
  background: rgba(240, 242, 245, 0.8);
  color: #4a5568;
  cursor: default;
  border-color: #e2e8f0;
}

input[readonly]:focus, textarea[readonly]:focus {
  transform: none;
  box-shadow: none;
  border-color: #e2e8f0;
}

/* ===== SMOOTH TRANSITIONS ===== */
* {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== VALIDATION STYLES ===== */
.field-error {
  color: #e53e3e;
  font-size: 0.8rem;
  margin-top: 5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: slideDown 0.3s ease-out;
}

.field-error::before {
  content: '⚠️';
  font-size: 0.9rem;
}

input.error, textarea.error {
  border-color: #e53e3e !important;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1) !important;
  background: rgba(254, 226, 226, 0.5) !important;
}

input.error:focus, textarea.error:focus {
  border-color: #e53e3e !important;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.2) !important;
}

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

/* ===== MESSAGES ÉLÉGANTS ===== */
.success-message-elegant, .error-message-elegant {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 400px;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(20px);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.success-message-elegant {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  border-left: 4px solid #2f855a;
}

.error-message-elegant {
  background: linear-gradient(135deg, #f56565, #e53e3e);
  color: white;
  border-left: 4px solid #c53030;
}

.success-message-elegant.show, .error-message-elegant.show {
  transform: translateX(0);
  opacity: 1;
}

.message-content {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.message-content i:first-child {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.message-content span {
  flex: 1;
  font-weight: 500;
  line-height: 1.4;
}

.close-message {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.close-message:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== ÉTATS DE CHARGEMENT ===== */
.loading-state {
  opacity: 0.7;
  cursor: not-allowed !important;
}

.loading-state:hover {
  transform: none !important;
}

.loading {
  animation: spin 1s linear infinite;
}

.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.global-loading.show {
  opacity: 1;
}

.loading-content {
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e2e8f0;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loading-content p {
  color: #4a5568;
  font-weight: 500;
  margin: 0;
  font-size: 1.1rem;
}

/* ===== RESPONSIVE POUR MESSAGES ===== */
@media (max-width: 480px) {
  .success-message-elegant, .error-message-elegant {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    transform: translateY(-100%);
  }
  
  .success-message-elegant.show, .error-message-elegant.show {
    transform: translateY(0);
  }
}

