/* Sony A7R V Shutter Count & RAW Inspector Styles */

:root {
  --bg-primary: #0d0f14;
  --bg-surface: #151821;
  --bg-surface-elevated: #1c212c;
  --bg-surface-hover: #242a38;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #ff5500;
  
  --sony-orange: #ff5500;
  --sony-orange-glow: rgba(255, 85, 0, 0.25);
  --sony-orange-hover: #ff6a1a;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --info: #38bdf8;
  --warning: #f59e0b;
  --error: #ef4444;

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-orange: 0 0 24px var(--sony-orange-glow);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Header */
header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(21, 24, 33, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  background: var(--sony-orange);
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px var(--sony-orange-glow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

.privacy-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--success);
}

/* Drop Zone */
.dropzone-container {
  margin: 2rem 0;
}

.dropzone {
  appearance: none;
  width: 100%;
  border: 2px dashed var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  position: relative;
  overflow: hidden;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--sony-orange);
  background: var(--bg-surface-elevated);
  box-shadow: var(--shadow-orange);
  transform: translateY(-2px);
}

.dropzone:focus-visible,
.btn-secondary:focus-visible,
.search-input:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 3px;
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  background: rgba(255, 85, 0, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sony-orange);
  transition: transform 0.2s ease;
}

.dropzone:hover .dropzone-icon {
  transform: scale(1.1);
}

.dropzone-icon svg {
  width: 32px;
  height: 32px;
}

.dropzone-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.dropzone-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.btn-select {
  display: inline-block;
  background: var(--sony-orange);
  color: #fff;
  border: none;
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px var(--sony-orange-glow);
}

.error-message {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(239, 68, 68, 0.55);
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn-select:hover {
  background: var(--sony-orange-hover);
  transform: translateY(-1px);
}

.dropzone-supported {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Loading State */
.loading-card {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  margin: 2rem 0;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-subtle);
  border-top-color: var(--sony-orange);
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.loading-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Results Section */
.results-container {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

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

/* Hero Shutter Count Card */
.hero-card {
  background: linear-gradient(135deg, var(--bg-surface-elevated) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--sony-orange) 0%, #ff884d 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}

.hero-label-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.hero-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sony-orange);
}

.badge-health {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.shutter-number {
  font-family: var(--font-mono);
  font-size: 3.8rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #fff;
  margin-bottom: 0.5rem;
}

.shutter-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.progress-container {
  margin-top: 1rem;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.progress-bar-bg {
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sony-orange), #ff884d);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.65rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Two-column layout for details */
.details-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Preview Card */
.preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.preview-image-box {
  width: 100%;
  aspect-ratio: 3 / 2;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  border: 1px solid var(--border-subtle);
}

.preview-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}

.file-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.85rem;
}

.file-meta-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 0.4rem;
}

.file-meta-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.file-meta-label {
  color: var(--text-muted);
}

.file-meta-val {
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  word-break: break-all;
}

/* Metadata Grid */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.meta-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.meta-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--sony-orange);
  font-weight: 700;
  font-size: 0.95rem;
}

.meta-card-header svg {
  width: 18px;
  height: 18px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table td {
  padding: 0.45rem 0;
  vertical-align: top;
}

.data-table td.label {
  color: var(--text-muted);
  width: 45%;
  font-weight: 500;
}

.data-table td.val {
  color: var(--text-primary);
  font-weight: 600;
  text-align: right;
}

.badge-tag {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Raw Tag Inspector */
.inspector-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.inspector-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.inspector-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.badge-count {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

.inspector-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-input {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
  outline: none;
  min-width: 220px;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--sony-orange);
}

.inspector-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.raw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.raw-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.65rem 0.85rem;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--border-subtle);
}

.raw-table td {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.raw-table tr:hover td {
  background: var(--bg-surface-hover);
}

.raw-table td.tag-id {
  font-family: var(--font-mono);
  color: var(--sony-orange);
  font-weight: 600;
  white-space: nowrap;
}

.raw-table td.tag-name {
  font-weight: 600;
  color: var(--text-primary);
}

.raw-table td.tag-dir,
.raw-table td.tag-cat {
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-cat {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}

.raw-table td.tag-val {
  font-family: var(--font-mono);
  word-break: break-word;
  max-width: 420px;
  color: #e2e8f0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-surface-elevated);
  color: #fff;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--sony-orange);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .details-layout {
    grid-template-columns: 1fr;
  }
  .meta-grid {
    grid-template-columns: 1fr;
  }
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .shutter-number {
    font-size: 2.8rem;
  }
}
