/* DeltaPhotoLog Custom Styles */

/* Mobile-first base styles */
:root {
  --header-height: 50px;
  --header-bg: #dee2e6;
  --selected-bg: #cfe2ff;
  --capture-area-bg: #f8f9fa;
}

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

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

/* App Header */
.app-header {
  background-color: var(--header-bg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  position: relative;
  border-bottom: 3px solid #000;
  min-height: var(--header-height);
}

.header-title {
  flex: 0 1 auto;
  text-align: center;
  font-size: 1rem;
  white-space: nowrap;
}

.header-spacer {
  width: 40px;
  flex-shrink: 0;
}

.header-user-name {
  font-size: 0.8rem;
  font-weight: 500;
  text-align: right;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Responsive header adjustments */
@media (min-width: 768px) {
  .header-user-name {
    font-size: 0.9rem;
  }
}

@media (max-width: 374px) {
  .header-title {
    font-size: 0.85rem;
  }
  .header-user-name {
    font-size: 0.7rem;
  }
  .app-header {
    padding: 10px 8px;
  }
}

/* Burger Menu Button */
.burger-menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Burger Menu Overlay */
.burger-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0);
  z-index: 1040;
  transition: background-color 0.25s ease;
}

.burger-menu-overlay.open {
  background-color: rgba(0, 0, 0, 0.4);
}

/* Burger Slide-out Menu */
.burger-menu {
  position: fixed;
  top: 0;
  left: -260px;
  width: 260px;
  height: 100%;
  background-color: #fff;
  z-index: 1050;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
  transition: left 0.25s ease;
  display: flex;
  flex-direction: column;
  padding-top: 16px;
}

.burger-menu.open {
  left: 0;
}

.burger-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  text-decoration: none;
  color: #212529;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.15s;
}

.burger-menu-item:hover {
  background-color: #f0f0f0;
  color: #212529;
}

.burger-menu-item i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.burger-menu-logout {
  color: #dc3545;
}

.burger-menu-logout:hover {
  color: #dc3545;
  background-color: #fff5f5;
}

.burger-menu-divider {
  height: 1px;
  background-color: #dee2e6;
  margin: 8px 16px;
}

/* Language Flags */
.burger-menu-flags {
  display: flex;
  gap: 12px;
  padding: 10px 20px;
}

.flag-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px solid #dee2e6;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
}

.flag-btn:hover {
  border-color: #adb5bd;
}

.flag-btn.active {
  border-color: #0d6efd;
  background-color: #e7f1ff;
  font-weight: 600;
}

.flag-icon {
  width: 24px;
  height: 16px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

.flag-label {
  font-size: 0.85rem;
}

.app-header .back-link {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  text-decoration: none;
}

/* Sub-header */
.sub-header {
  background-color: #f8f9fa;
  padding: 8px 16px;
  text-align: center;
  border-bottom: 2px solid #000;
}

/* Login Page */
.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.login-container .form-control {
  padding: 16px;
  font-size: 1rem;
  border-radius: 20px;
}

.login-container .btn-login {
  padding: 14px 48px;
  font-size: 1.1rem;
  border-radius: 25px;
}

/* Auto List Page */
.auto-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.auto-item {
  padding: 16px 20px;
  margin-bottom: 12px;
  border: 2px solid #000;
  border-radius: 25px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.auto-item:hover,
.auto-item:active {
  background-color: var(--selected-bg);
}

.auto-item.selected {
  background-color: var(--selected-bg);
}

/* Auto item: plate + item_type badge + optional make/model line */
.auto-item-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auto-item-plate {
  font-weight: 600;
}

.auto-item-sub {
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 400;
  color: #555;
}

.item-type-badge {
  display: inline-block;
  padding: 2px 12px;
  border: 2px solid #000;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.badge-observation {
  background-color: #cfe9ff;
  color: #084298;
}

.badge-command {
  background-color: #ffe5b4;
  color: #7a4f01;
}

/* Segmented item_type filter above the auto list */
.item-type-filters {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.item-type-filter-btn {
  padding: 6px 18px;
  border: 2px solid #000;
  border-radius: 20px;
  background: #fff;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.item-type-filter-btn:hover {
  background-color: #e9ecef;
}

.item-type-filter-btn.active {
  background-color: var(--selected-bg);
  border-color: #0d6efd;
  color: #0d6efd;
  font-weight: 600;
}

/* Action Select Page */
.action-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  gap: 24px;
}

.action-btn {
  width: 180px;
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid #000;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn i {
  font-size: 4rem;
  margin-bottom: 12px;
}

.action-btn:hover,
.action-btn.selected {
  background-color: var(--selected-bg);
}

/* Capture Page */
.capture-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Carousel */
.media-carousel {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 12px;
  gap: 12px;
  border-bottom: 2px solid #000;
  background-color: #fff;
}

.media-carousel::-webkit-scrollbar {
  height: 6px;
}

.media-carousel::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.media-carousel::-webkit-scrollbar-track {
  background-color: rgba(0, 0, 0, 0.1);
}

.carousel-item-custom {
  flex: 0 0 80px;
  text-align: center;
}

.carousel-item-custom img,
.carousel-item-custom video {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border: 2px solid #000;
  border-radius: 8px;
}

.carousel-item-custom .label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 4px;
}

.carousel-item-custom .details {
  font-size: 0.65rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
}

/* Camera Preview */
.camera-preview {
  flex: 1;
  background-color: var(--capture-area-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 250px;
  border: 3px solid #000;
  margin: 12px;
  border-radius: 12px;
  overflow: hidden;
}

.camera-preview video,
.camera-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-preview .placeholder {
  color: #999;
  font-size: 1.2rem;
}

/* Captured state - green border */
.camera-preview.captured {
  border-color: #198754;
  border-width: 4px;
}

/* Video Timer Overlay */
.timer-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: rgba(220, 53, 69, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: monospace;
}

.timer-overlay.recording {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Details Input */
.details-input {
  padding: 0 12px;
  margin-bottom: 12px;
}

.details-input textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #000;
  border-radius: 12px;
  resize: none;
  font-size: 1rem;
}

/* Action Buttons */
.capture-actions {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px;
  border-top: 2px solid #000;
  background-color: #fff;
}

.btn-retake {
  padding: 12px 20px;
  font-weight: 600;
}

.btn-shutter {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #000;
}

.btn-shutter i {
  font-size: 2rem;
}

.btn-shutter.recording {
  background-color: #dc3545;
  color: white;
}

.btn-send {
  padding: 12px 24px;
  font-weight: 600;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1060;
}

/* Utility Classes */
.touch-friendly {
  min-height: 48px;
  min-width: 48px;
}

/* Library Page */
.library-search {
  padding: 12px 16px 0;
  background-color: #f8f9fa;
}

.library-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.library-search-icon {
  position: absolute;
  left: 14px;
  color: #888;
  font-size: 0.9rem;
  pointer-events: none;
}

.library-search-input {
  padding: 10px 38px 10px 38px;
  border: 2px solid #000;
  border-radius: 25px;
  font-size: 0.9rem;
}

.library-search-input:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.15rem rgba(13,110,253,0.15);
}

.library-search-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #888;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.library-search-clear:hover {
  color: #333;
}

.library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 2px solid #000;
  background-color: #f8f9fa;
  align-items: center;
}

.library-sort-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 2px solid #000;
  border-radius: 20px;
  background: #fff;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.library-sort-btn:hover {
  background-color: #e9ecef;
}

.library-sort-btn i {
  font-size: 0.9rem;
}

.library-filter-btn {
  padding: 6px 18px;
  border: 2px solid #000;
  border-radius: 20px;
  background: #fff;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.library-filter-btn:hover {
  background-color: #e9ecef;
}

.library-filter-btn.active {
  background-color: var(--selected-bg);
  border-color: #0d6efd;
  color: #0d6efd;
  font-weight: 600;
}

.library-grid {
  flex: 1 0 auto;
  overflow-y: visible;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-content: flex-start;
}

.library-show-more-wrap {
  padding: 8px 16px 24px;
  text-align: center;
}

.library-show-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 700;
  color: #000;
  background: #fff;
  border: 3px solid #000;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 4px 4px 0 #000;
}

.library-show-more-btn:hover {
  background: #f0f0f0;
  box-shadow: 2px 2px 0 #000;
  transform: translate(2px, 2px);
}

.library-show-more-btn:active {
  box-shadow: 0 0 0 #000;
  transform: translate(4px, 4px);
}

.library-card {
  width: calc(50% - 8px);
  border: 2px solid #000;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s;
  cursor: pointer;
}

.library-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.library-card-media {
  position: relative;
  width: 100%;
  height: 120px;
  background-color: #f0f0f0;
}

.library-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-card-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: rgba(0,0,0,0.6);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.library-card-type-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background-color: rgba(0,0,0,0.6);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.library-card-info {
  padding: 8px 10px;
}

.library-card-plate {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.library-card-date {
  font-size: 0.75rem;
  color: #666;
}

.library-card-details {
  font-size: 0.75rem;
  color: #888;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-card-user {
  margin-top: 6px;
}

.library-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: #e9ecef;
  color: #495057;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
}

.library-user-badge i {
  font-size: 0.75rem;
}

.library-empty {
  width: 100%;
  text-align: center;
  padding: 40px 16px;
  color: #6c757d;
}

@media (max-width: 400px) {
  .library-card {
    width: 100%;
  }
}

@media (min-width: 768px) {
  .library-card {
    width: calc(33.33% - 11px);
  }
  .library-card-media {
    height: 160px;
  }
}

@media (min-width: 1024px) {
  .library-card {
    width: calc(25% - 12px);
  }
  .library-card-media {
    height: 180px;
  }
}

/* Media Detail Modal */
.media-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0);
  z-index: 1070;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: background-color 0.25s ease;
}

.media-modal-overlay.open {
  background-color: rgba(0, 0, 0, 0.6);
}

.media-modal {
  background: #fff;
  border-radius: 12px;
  width: 95vw;
  height: 92vh;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transform: translateY(30px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.media-modal-overlay.open .media-modal {
  transform: translateY(0);
  opacity: 1;
}

.media-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 2px solid #000;
}

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

.media-modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color 0.15s;
  line-height: 1;
}

.media-modal-close:hover {
  background-color: #f0f0f0;
}

.media-modal-body {
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.media-modal-preview {
  width: 100%;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-media-content {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.media-modal-details {
  padding: 16px;
}

.media-detail-row {
  display: flex;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  gap: 12px;
}

.media-detail-row:last-child {
  border-bottom: none;
}

.media-detail-label {
  color: #666;
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 120px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.media-detail-label i {
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
}

.media-detail-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: #212529;
  word-break: break-word;
}

.media-detail-notes .media-detail-value {
  font-weight: 400;
  line-height: 1.5;
}

@media (max-width: 400px) {
  .media-modal {
    border-radius: 12px;
  }
  .media-detail-label {
    min-width: 90px;
    font-size: 0.75rem;
  }
  .media-detail-value {
    font-size: 0.85rem;
  }
}
