/* app/(protected)/profile/profile-page.css */

.profile-page {
  --bg: #020617;
  --bg-card: #0f172a;
  --bg-input: #020617;
  --border: #1e293b;
  --border-focus: #6366f1;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --color-blue: #3b82f6;
  --color-emerald: #10b981;
  --color-amber: #f59e0b;
  --color-rose: #f43f5e;
  --radius: 0.75rem;
  --radius-lg: 1rem;

  background-color: var(--bg);
  min-height: 100vh;
  padding: 1.5rem;
  color: var(--text-primary);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (min-width: 768px) {
  .profile-page {
    padding: 2.5rem;
  }
}

.profile-container {
  max-width: 72rem;
  margin: 0 auto;
}

/* ── Alerts ── */
.profile-alert {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-alert--success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--color-emerald);
}

.profile-alert--error {
  background-color: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--color-rose);
}

.profile-alert svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* ── Loading ── */
.profile-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 0.75rem;
}

.profile-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.profile-loading span {
  color: var(--text-secondary);
}

/* ── Grid Layout ── */
.profile-grid-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .profile-grid-wrapper {
    grid-template-columns: 1.5fr 1fr;
  }
}

.profile-left-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Panel Card ── */
.profile-panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.profile-panel-header {
  margin-bottom: 1.25rem;
}

.profile-panel-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0;
}

.profile-panel-header p {
  margin: 0.25rem 0 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ── Form Grid ── */
.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .profile-form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.profile-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.profile-form-field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.profile-form-field input,
.profile-form-field textarea {
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 150ms ease;
}

.profile-form-field input:focus,
.profile-form-field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.profile-form-field input:read-only {
  background-color: rgba(30, 41, 59, 0.5);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-field-full {
  grid-column: 1 / -1;
}

.password-form {
  grid-template-columns: 1fr;
}

/* ── Buttons ── */
.profile-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  border: none;
}

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

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

.profile-action-btn-primary:hover:not(:disabled) {
  background-color: #2563eb;
}

.profile-action-btn-secondary {
  background-color: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.profile-action-btn-secondary:hover:not(:disabled) {
  background-color: rgba(99, 102, 241, 0.25);
}

.profile-action-btn-gradient {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  width: 100%;
}

.profile-action-btn-gradient:hover:not(:disabled) {
  opacity: 0.9;
}

/* ── Service Info ── */
.service-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.service-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.service-info-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.service-info-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.service-info-value--active {
  color: var(--color-emerald);
}

.service-info-value--inactive {
  color: var(--color-rose);
}

.service-info-value--pending {
  color: var(--color-amber);
}

/* ── Linked Accounts ── */
.linked-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.linked-account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.linked-account-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.linked-account-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.linked-account-badge {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.linked-account-badge--primary {
  background-color: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.linked-account-badge--inactive {
  background-color: rgba(244, 63, 94, 0.2);
  color: var(--color-rose);
}

.linked-account-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.linked-account-expiry {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.linked-account-expiry--warning {
  color: var(--color-amber);
  font-weight: 600;
}

/* ── Identity Footprints ── */
.identity-footprints-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.identity-footprint-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.identity-footprint-left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.identity-footprint-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.identity-footprint-icon.current {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--color-emerald);
}

.identity-footprint-icon.other {
  background-color: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.identity-footprint-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.identity-footprint-details {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.device-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.identity-badge-current {
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.5rem;
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--color-emerald);
  border-radius: 9999px;
  text-transform: uppercase;
}

.device-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.identity-footprint-status {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-emerald);
}

/* ── Password Strength ── */
.password-strength-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.password-strength-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.password-strength-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.password-strength-value {
  font-size: 0.8125rem;
  font-weight: 600;
}

.password-strength-value.weak {
  color: var(--color-rose);
}

.password-strength-value.moderate {
  color: var(--color-amber);
}

.password-strength-value.strong {
  color: var(--color-emerald);
}

.password-strength-bars {
  display: flex;
  gap: 0.375rem;
}

.password-strength-bar {
  flex: 1;
  height: 0.375rem;
  background-color: var(--border);
  border-radius: 9999px;
  transition: all 200ms ease;
}

.password-strength-bar.active.weak {
  background-color: var(--color-rose);
}

.password-strength-bar.active.moderate {
  background-color: var(--color-amber);
}

.password-strength-bar.active.strong {
  background-color: var(--color-emerald);
}

/* ── Divider ── */
.profile-form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0;
}

/* ── Error State ── */
.profile-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 1rem;
}

.profile-error p {
  color: var(--text-secondary);
}

.profile-error button {
  padding: 0.625rem 1.25rem;
  background-color: var(--color-blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
}

/* ── Utility ── */
.font-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.flex {
  display: flex;
}

.justify-end {
  justify-content: flex-end;
}

.pt-2 {
  padding-top: 0.5rem;
}