/* Shared Utility Classes - Used across multiple pages */

/* ========================================
   PASSWORD TOGGLE BUTTON
   Used in: login.css, register.css
   ======================================== */
.password-toggle-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  border-radius: var(--border-radius-sm);
  transition: background-color 0.2s ease;
  font-size: 16px;
}

.password-toggle-btn:hover:not(:disabled) {
  background-color: rgba(61, 165, 217, 0.1);
}

.password-toggle-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   PASSWORD FIELD CONTAINER
   Used in: login.html
   ======================================== */
.password-field-container {
  position: relative;
}

/* ========================================
   ERROR TEXT
   Used in: login.css, register.css
   ======================================== */
.error-text {
  color: var(--error-color);
  margin-top: 0.25rem;
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

/* ========================================
   TEXT DECORATION UTILITIES
   Used in: login.css, register.css
   ======================================== */
.text-decoration-none {
  text-decoration: none;
}

.text-decoration-none:hover {
  text-decoration: none;
}

/* ========================================
   ALERT/MESSAGE CLASSES
   Replaces: message-* classes in layout.css
   ======================================== */
.alert {
  padding: var(--spacing-sm) var(--spacing-md);
  margin-bottom: var(--spacing-md);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  border: 1px solid;
}

.alert-error {
  background-color: rgba(255, 182, 193, 0.2);
  border-color: var(--error-color);
  color: #8b0000;
}

.alert-success {
  background-color: rgba(144, 238, 144, 0.2);
  border-color: var(--success-color);
  color: #006400;
}

.alert-warning {
  background-color: rgba(240, 230, 140, 0.2);
  border-color: var(--warning-color);
  color: #b8860b;
}

/* ========================================
   CARD WRAPPER BASE
   Shared styling for all card-like containers
   ======================================== */
.card-base {
  background: white;
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

/* ========================================
   DATE/MONTH PICKER UTILITIES
   Used in: dashboard.html, payslip.html
   ======================================== */
.date-header {
  background: var(--primary-gradient);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--primary-color);
}

.date-header h2 {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.date-picker-clickable {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.date-picker-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ========================================
   SUMMARY CARD COMPONENTS
   Shared card styles for dashboard and payslip
   ======================================== */
.summary-card {
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  text-align: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  min-height: var(--touch-target-min);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border-light);
}

.summary-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* Summary Card Typography */
.summary-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
  line-height: 1.3;
}

.summary-value {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.summary-value.large {
  font-size: var(--font-size-xl);
  font-weight: 700;
}

.summary-detail {
  font-size: 12px;
  line-height: 1.2;
  opacity: 0.8;
  color: var(--text-secondary);
}

/* Summary Card Color Variants */
.summary-card.primary {
  background: var(--primary-gradient);
  border-color: var(--primary-color);
  color: white;
  box-shadow: var(--shadow);
}

.summary-card.primary:hover {
  box-shadow: var(--shadow-lg);
}

.summary-card.cash {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.summary-card.card {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.summary-card.tronc {
  background: var(--mikado-yellow);
  border-color: var(--mikado-yellow);
  color: var(--text-primary);
}

/* White text for colored cards */
.summary-card:is(.primary, .cash, .card)
:is(.summary-label, .summary-value, .summary-detail) {
  color: white;
}

.summary-card:is(.primary, .cash, .card) .summary-label {
  opacity: 0.9;
}

/* Dark text for yellow tronc card */
.summary-card.tronc :is(.summary-label, .summary-value, .summary-detail) {
  color: var(--text-primary);
}

/* Default Card (no color variant) */
.summary-card:not(.primary):not(.cash):not(.card):not(.tronc) {
  background: var(--background-light);
  border-color: var(--border-light);
}

.summary-card:not(.primary):not(.cash):not(.card):not(.tronc):hover {
  background: white;
}

/* ========================================
   PAGE HEADER PATTERN
   Used in: dashboard.html, profile.html, stats.html
   ======================================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
  font-size: var(--font-size-xl);
  margin: 0;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================
   BUTTON LINK STYLE
   Used in: profile.html, stats.html
   ======================================== */
.btn-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: var(--font-size-sm);
  padding: var(--spacing-xs) 0;
  transition: opacity 0.2s ease;
}

.btn-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* ========================================
   OFFLINE WARNING/BANNER
   Used in: profile.html, stats.html
   ======================================== */
.offline-banner {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background-color: rgba(255, 193, 7, 0.1);
  border: 1px solid var(--warning-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  color: #856404;
  font-size: var(--font-size-sm);
}

.offline-banner svg {
  flex-shrink: 0;
  color: var(--warning-color);
}

/* ========================================
   LOADING SKELETON UTILITIES
   Used in: dashboard.html, stats.html
   ======================================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ========================================
   COUNTRY SELECT DROPDOWN
   Used in: profile.html, register.html
   ======================================== */
.country-select {
  max-height: 300px;
}

/* ========================================
   BOTTOM NAVIGATION BAR
   Native-style bottom navigation with icons only
   ======================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 400px;
  margin: 0 auto;
  padding: 0.5rem 0 1.5rem 0;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  border-radius: var(--border-radius);
}

.bottom-nav-item:hover {
  background: var(--background-light);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav-item.active {
  color: var(--primary-color);
}

.bottom-nav-item.active svg {
  stroke: var(--primary-color);
  fill: var(--primary-color);
}

/* Add padding to main to prevent content from hiding behind bottom nav */
body:has(.bottom-nav) main {
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */

/* Mobile-specific adjustments */
@media (max-width: 480px) {
  .password-toggle-btn {
    right: 0.5rem;
  }

  .card-base {
    padding: var(--spacing-md);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-sm);
  }

  .btn-link {
    align-self: flex-start;
  }

  .date-header h2 {
    font-size: 0.85rem;
  }

  .summary-card {
    padding: var(--spacing-sm);
  }

  .summary-label {
    font-size: 12px;
  }

  .summary-value {
    font-size: var(--font-size-base);
  }

  .summary-value.large {
    font-size: var(--font-size-lg);
  }

  .summary-detail {
    font-size: 11px;
  }
}

/* Tablet and larger screens */
@media (min-width: 768px) {
  .card-base {
    padding: var(--spacing-xl);
  }

  .bottom-nav-container {
    max-width: 500px;
  }

  .date-header h2 {
    font-size: 1.1rem;
  }

  .summary-card {
    padding: var(--spacing-lg);
  }

  .summary-value {
    font-size: var(--font-size-xl);
  }

  .summary-value.large {
    font-size: calc(var(--font-size-xl) * 1.5);
  }
}
