/**
 * Photo Vault PWA — Styles
 *
 * Mobile-first dark theme for the encrypted photo upload interface.
 * Uses a clean, minimal design with full-width buttons on mobile.
 *
 * @module style
 */

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

:root {
  --bg-primary: #0f0f0f;
  --bg-card: #1a1a2e;
  --accent: #4fc3f7;
  --accent-hover: #29b6f6;
  --text-primary: #e0e0e0;
  --text-secondary: #9e9e9e;
  --border: #2a2a3e;
  --success: #66bb6a;
  --error: #ef5350;
  --warning: #ffa726;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  text-align: center;
  padding: 1.5rem 0;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.5px;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card h2 {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

input[type='text'],
input[type='password'] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s;
}

input[type='text']:focus,
input[type='password']:focus {
  outline: none;
  border-color: var(--accent);
}

input[type='file'] {
  width: 100%;
  padding: 0.75rem;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

input[type='file']:hover {
  border-color: var(--accent);
}

button {
  width: 100%;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background-color: var(--accent);
  color: #0f0f0f;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

button:hover {
  background-color: var(--accent-hover);
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

/* Upload progress bar */
#upload-progress {
  margin-top: 1rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 4px;
  transition: width 0.3s ease;
}

#progress-text {
  display: block;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Status messages */
#upload-status,
#status-bar {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  text-align: center;
}

.status-success {
  background-color: rgba(102, 187, 106, 0.15);
  color: var(--success);
  border: 1px solid rgba(102, 187, 106, 0.3);
}

.status-error {
  background-color: rgba(239, 83, 80, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 83, 80, 0.3);
}

.status-pending {
  background-color: rgba(255, 167, 38, 0.15);
  color: var(--warning);
  border: 1px solid rgba(255, 167, 38, 0.3);
}

/* Device status badge */
.device-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.device-badge.approved {
  background-color: rgba(102, 187, 106, 0.2);
  color: var(--success);
}

.device-badge.pending {
  background-color: rgba(255, 167, 38, 0.2);
  color: var(--warning);
}

.device-badge.unregistered {
  background-color: rgba(158, 158, 158, 0.2);
  color: var(--text-secondary);
}

/* Photo preview grid */
.photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.photo-preview img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* Responsive tweaks */
@media (min-width: 768px) {
  #app {
    padding: 2rem;
  }

  button {
    width: auto;
    min-width: 200px;
  }
}
