/* VARIABLES - Laboratori fotogràfic */
:root {
  --bg-primary: #e8e8e8;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #ffffff;
  --accent: #d63031;
  --accent-light: #e8d4d4;
  --text-primary: #222222;
  --text-secondary: #444444;
  --text-dim: #888888;
  --border: #cccccc;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #c0392b;
  --font-mono: 'Courier New', Courier, monospace;
  --font-sans: Arial, Helvetica, sans-serif;
  --radius: 6px;
}

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

html, body {
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */
.header {
  padding: 12px 16px;
  text-align: center;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border);
}

.logo {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  margin: 0;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lang-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: bold;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.lang-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* FOOTER */
.footer {
  padding: 8px 16px;
  text-align: center;
  background: var(--bg-tertiary);
  border-top: 2px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

/* MAIN */
.main {
  flex: 1;
  padding: 12px;
}

/* CAMERA SECTION */
.camera-section {
  margin-bottom: 12px;
}

.camera-view {
  position: relative;
  width: 100%;
  height: 160px;
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
  cursor: crosshair;
}

.camera-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-view.active {
  border: 3px solid var(--accent);
}

.camera-canvas {
  display: none;
}

/* Spot crosshair */
.spot-crosshair {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
}

.spot-crosshair.visible {
  display: block;
}

.spot-ring {
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
  animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0.3; }
}

.spot-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  padding: 4px 8px;
  border-radius: 4px;
  display: none;
}

.camera-view.active .spot-hint {
  display: block;
}

.camera-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.camera-controls .btn {
  flex: 1;
}

.btn-info {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.camera-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ev-display {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.ev-adjust {
  display: flex;
  gap: 8px;
}

.ev-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.5);
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.ev-btn:active {
  background: var(--accent);
}

/* CALC BLOCK */
.calc-block {
  margin-bottom: 12px;
}

.calc-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: bold;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.calc-label svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-secondary);
}

/* PINHOLE GRID */
.pinhole-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.pinhole-btn {
  flex: 1;
  min-width: 45px;
  padding: 12px 8px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: bold;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.pinhole-btn:hover {
  border-color: var(--text-dim);
}

.pinhole-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.input-custom {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-primary);
}

.input-custom:focus {
  outline: none;
  border-color: var(--accent);
}

.input-custom::placeholder {
  color: var(--text-dim);
}

/* SELECT */
.select-large {
  width: 100%;
  padding: 12px 40px 12px 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23444' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select-large:focus {
  outline: none;
  border-color: var(--accent);
}

.select-large optgroup {
  font-weight: bold;
  color: var(--text-dim);
}

.select-large option {
  font-weight: normal;
  color: var(--text-primary);
}

.iso-custom {
  margin-top: 8px;
}

.input-small {
  width: 100px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
}

.input-small:focus {
  outline: none;
  border-color: var(--accent);
}

.input-small::placeholder {
  color: var(--text-dim);
}

/* METER INPUTS */
.meter-block {
  padding: 12px;
  background: var(--bg-secondary);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}

.meter-block.hidden {
  display: none;
}

.meter-inputs {
  display: flex;
  gap: 8px;
}

.select-small {
  flex: 1;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
}

/* ICONS */
.icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.icon.small {
  width: 16px;
  height: 16px;
}

/* RESULT */
.result-block {
  text-align: center;
  padding: 24px 16px;
  margin: 16px 0;
  background: var(--bg-tertiary);
  border: 3px solid var(--accent);
  border-radius: var(--radius);
}

.result-label {
  font-size: 12px;
  font-weight: bold;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.result-value {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: bold;
  color: var(--accent);
}

.result-factor {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ACTION BUTTONS */
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: bold;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover {
  border-color: var(--text-dim);
}

.btn svg {
  width: 28px;
  height: 28px;
}

.btn-circle {
  width: 70px;
  height: 70px;
  padding: 16px;
  border-radius: 50%;
}

.btn-circle.btn-small {
  width: 50px;
  height: 50px;
  padding: 10px;
}

.btn-circle.btn-small svg {
  width: 24px;
  height: 24px;
}

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

.btn-primary svg {
  stroke: white;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-secondary {
  flex: 1;
  padding: 10px;
}

.btn-secondary svg {
  width: 20px;
  height: 20px;
  margin-right: 4px;
}

.btn-small {
  padding: 8px 12px;
  font-size: 12px;
}

.full-width {
  width: 100%;
}

/* TIMER */
.timer-section {
  padding: 16px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.timer-section.hidden {
  display: none;
}

.timer-display {
  text-align: center;
  margin-bottom: 12px;
}

#timer-countdown {
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: bold;
  color: var(--text-primary);
}

.timer-progress {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.timer-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

.timer-controls {
  display: flex;
  gap: 8px;
}

/* NAV TABS */
.nav-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 2px solid var(--border);
  margin-top: auto;
}

.tab {
  flex: 1;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: bold;
  color: var(--text-secondary);
  cursor: pointer;
}

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

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* TAB CONTENT */
.tab-content {
  padding: 16px;
}

.tab-content.hidden {
  display: none;
}

/* SECTION BLOCK */
.section-block {
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 24px;
}

/* DIARY */
.diary-list {
  margin-bottom: 12px;
}

.diary-entry {
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.diary-entry-time {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: bold;
  color: var(--accent);
}

.diary-entry-date {
  font-size: 12px;
  color: var(--text-dim);
}

.diary-entry-details {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.diary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* INPUT */
.input-large {
  width: 100%;
  padding: 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-primary);
}

.input-large:focus {
  outline: none;
  border-color: var(--accent);
}

.input-group {
  margin-bottom: 12px;
}

/* LICENSE */
.license-status {
  font-size: 13px;
  margin-top: 8px;
  color: var(--success);
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal.show {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 360px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.modal-content h2 {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 16px;
  color: var(--accent);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  resize: vertical;
  min-height: 80px;
}

.textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="file"] {
  width: 100%;
  padding: 10px;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.gps-result {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.form-actions .btn .icon {
  width: 18px;
  height: 18px;
  margin-right: 4px;
}

.hidden {
  display: none !important;
}

/* DIARY ENTRY INDICATORS */
.diary-entry-indicators {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-size: 16px;
}

.diary-entry-photo {
  max-width: 100%;
  border-radius: var(--radius);
  margin-top: 8px;
}

.diary-entry-location {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  display: block;
}

/* RESPONSIVE */
@media (max-width: 380px) {
  .pinhole-btn {
    min-width: 40px;
    font-size: 14px;
    padding: 10px 6px;
  }
  
  .result-value {
    font-size: 32px;
  }
}