/* Customer Portal Styles */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-success: #16a34a;
  --color-error: #dc2626;
  --color-warning: #d97706;
  --color-bg: #e2e8f0;
  --color-bg-card: #ffffff;
  --color-bg-secondary: #f1f5f9;
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-border: #94a3b8;
  --color-toggle-off: #64748b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

#portal-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Loading */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Header */
.portal-header {
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.portal-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.portal-header .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-header .logout-btn {
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
}

.portal-header .logout-btn:hover {
  color: var(--color-error);
}

/* Main Content */
.portal-main {
  flex: 1;
  padding: 32px 24px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* Cards */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  margin-bottom: 20px;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--color-error);
  margin-top: 4px;
}

/* Checkbox and Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.form-check label {
  cursor: pointer;
}

/* Toggle Switch */
.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}

.toggle-group:last-child {
  border-bottom: none;
}

.toggle-label {
  font-weight: 500;
}

.toggle-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-toggle-off);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.toggle input:checked + .toggle-slider {
  background-color: var(--color-success);
}

.toggle input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg);
}

/* Button feedback states */
.btn-success {
  background: var(--color-success) !important;
  color: white !important;
  transition: all 0.3s ease;
}

.btn-error {
  background: var(--color-error) !important;
  color: white !important;
  transition: all 0.3s ease;
}

.btn-success.btn-swell,
.btn-error.btn-swell {
  animation: btnSwell 0.4s ease-out;
}

@keyframes btnSwell {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.btn-block {
  width: 100%;
}

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

/* Login Page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 480px;
  text-align: left;
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.login-card .form-input {
  text-align: left;
}

/* Success Message */
.success-message {
  text-align: center;
  padding: 40px;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: var(--color-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.success-icon svg {
  width: 32px;
  height: 32px;
  stroke: white;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
}

.nav-tab {
  padding: 12px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.nav-tab:hover {
  color: var(--color-text);
}

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

/* Questions */
.question-group {
  margin-bottom: 24px;
}

.question-group h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text-muted);
}

.question-item {
  background: var(--color-bg-secondary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.question-text {
  font-weight: 500;
  margin-bottom: 4px;
}

.question-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

/* Grid Layout */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
}

.toast {
  background: var(--color-text);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  margin-top: 8px;
  animation: slideIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.toast.success {
  background: var(--color-success);
}

.toast.error {
  background: var(--color-error);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Address Grid */
.address-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .address-grid {
    grid-template-columns: 1fr;
  }
}
