/* DryClean360 — Tablet-first UI layer (Android tablets / Chrome) */

:root {
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --sidebar-width: 16rem;
  --sidebar-compact-width: 4.75rem;
  --touch-min: 48px;
  --topbar-height: 4rem;
}

html {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body.overflow-hidden {
  overflow: hidden;
}

/* ---- App shell ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

/* ---- Sidebar ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 40;
  backdrop-filter: blur(2px);
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: #0f172a;
  color: #fff;
  transform: translateX(-100%);
  transition: transform 0.25s ease, width 0.2s ease;
  border-right: 1px solid #1e293b;
}

.sidebar-open .sidebar-overlay {
  display: block;
}

.sidebar-open .app-sidebar {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #1e293b;
}

.sidebar-header-text {
  min-width: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  -webkit-overflow-scrolling: touch;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #1e293b;
}

.sidebar-compact-toggle {
  display: none;
  width: 100%;
  margin-bottom: 0.75rem;
}

.sidebar-link-icon,
.sidebar-logout-icon,
.sidebar-toggle-label-expand {
  display: none;
}

.sidebar-toggle-label-compact {
  display: inline;
}

.sidebar-expand-topbar {
  display: none;
}

.sidebar-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Desktop / large tablet landscape */
@media (min-width: 1024px) {
  .app-sidebar {
    position: sticky;
    transform: none;
    max-width: none;
    flex-shrink: 0;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .sidebar-compact-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-shell.sidebar-compact .app-sidebar {
    width: var(--sidebar-compact-width);
  }

  .app-shell.sidebar-compact .sidebar-header-text,
  .app-shell.sidebar-compact .sidebar-link-text,
  .app-shell.sidebar-compact .sidebar-user-meta,
  .app-shell.sidebar-compact .sidebar-logout-text {
    display: none;
  }

  .app-shell.sidebar-compact .sidebar-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
  }

  .app-shell.sidebar-compact .sidebar-link {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .app-shell.sidebar-compact .sidebar-user-row {
    justify-content: center;
  }

  .app-shell.sidebar-compact .sidebar-compact-toggle {
    display: inline-flex !important;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .app-shell.sidebar-compact .sidebar-toggle-label-compact {
    display: none;
  }

  .app-shell.sidebar-compact .sidebar-toggle-label-expand {
    display: inline;
    font-size: 0.75rem;
    font-weight: 600;
  }

  .app-shell.sidebar-compact .sidebar-logout-icon {
    display: inline;
    font-size: 1.125rem;
    line-height: 1;
  }

  .app-shell.sidebar-compact .sidebar-expand-topbar {
    display: inline-flex;
  }
}

/* ---- Top bar ---- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-height);
  padding: 0.75rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

@media (min-width: 768px) {
  .app-topbar {
    padding: 0.75rem 1.5rem;
  }
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.app-topbar-title {
  min-width: 0;
}

.app-topbar-title h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
}

.app-topbar-title p {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0.125rem 0 0;
}

.app-main-content {
  flex: 1;
  padding: 1rem;
}

@media (min-width: 768px) {
  .app-main-content {
    padding: 1.25rem 1.5rem;
  }
}

/* ---- Touch-friendly controls ---- */
.sidebar-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  color: #334155;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-icon-btn:active {
  background: #f1f5f9;
}

.app-sidebar .sidebar-icon-btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

.form-input,
.form-select,
textarea.form-input {
  min-height: var(--touch-min);
  font-size: 1rem;
  padding: 0.75rem 1rem;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  min-height: var(--touch-min);
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  border-radius: 0.75rem;
  touch-action: manipulation;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.btn-touch {
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1rem;
}

.sidebar-link {
  min-height: var(--touch-min);
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.pagination a,
.pagination span {
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 1rem;
}

/* Table action links — larger tap targets */
.table-action-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ---- Scrollable tables ---- */
.table-scroll-card {
  padding: 0;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.table-scroll table {
  min-width: 640px;
}

.table-scroll th,
.table-scroll td {
  white-space: nowrap;
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
}

@media (min-width: 1024px) {
  .table-scroll table {
    min-width: 100%;
  }
}

/* ---- Camera photo upload ---- */
.camera-upload-field {
  margin-bottom: 1rem;
}

.camera-upload-label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #334155;
  margin-bottom: 0.5rem;
}

.camera-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.camera-upload-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 8rem;
  padding: 1.25rem;
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  background: #f8fafc;
  color: #475569;
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, background 0.15s;
}

.camera-upload-btn:active,
.camera-file-input:focus + .camera-upload-btn {
  border-color: var(--brand-600);
  background: #eff6ff;
  color: var(--brand-700);
}

.camera-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--brand-600);
}

.camera-upload-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: #94a3b8;
  text-align: center;
}

.camera-photo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .camera-photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Filter toolbars ---- */
.toolbar-tablet {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .md\:block { display: block; }

  .toolbar-tablet {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
  }

  .toolbar-tablet-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    flex: 1;
  }

  .toolbar-tablet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

.filter-search-compact {
  max-width: 11rem;
  min-width: 9rem;
}

.customer-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.customer-modal.is-open {
  display: flex;
}

.customer-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.customer-modal-panel {
  position: relative;
  z-index: 10000;
  width: min(100%, 36rem);
  max-height: min(90vh, 640px);
  overflow-y: auto;
  margin: 0;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

.customer-modal-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

.customer-search-result {
  background: #fff;
}

/* ---- Auth pages on tablet ---- */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.auth-card {
  width: 100%;
  max-width: 28rem;
}

/* Utility */
.lg-only { display: none; }
.mobile-only { display: inline-flex; }

@media (min-width: 1024px) {
  .lg-only { display: inline-flex; }
  .mobile-only { display: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
