/**
 * PackDoor App Shell — ayrı mobil uygulama yüzeyi
 * body.pd-mobile-app içinde desktop chrome kapalı.
 */

:root {
  --pd-black: #0a0a0a;
  --pd-blue: #0080FF;
  --pd-blue-dim: #0066cc;
  --pd-surface: #f4f5f7;
  --pd-card: #ffffff;
  --pd-text: #111827;
  --pd-muted: #6b7280;
  --pd-border: #e5e7eb;
  --pd-danger: #dc2626;
  --pd-tabbar-h: 64px;
  --pd-top-h: 56px;
  --pd-radius: 14px;
  --pd-safe-b: env(safe-area-inset-bottom, 0px);
  --pd-safe-t: env(safe-area-inset-top, 0px);
}

/* —— App mode: desktop header & clutter kapalı —— */
body.pd-mobile-app .header-wrap,
body.pd-mobile-app .header-toggle-show,
body.pd-mobile-app .header-toggle-hide,
body.pd-mobile-app .header-top-strip {
  display: none !important;
}

body.pd-mobile-app {
  background: var(--pd-surface) !important;
  padding-top: calc(var(--pd-top-h) + var(--pd-safe-t)) !important;
  padding-bottom: calc(var(--pd-tabbar-h) + var(--pd-safe-b) + 8px) !important;
  min-height: 100dvh;
  overflow-x: hidden;
}

body.pd-mobile-app.pd-sheet-open {
  overflow: hidden;
}

body.pd-mobile-app .container {
  max-width: 100% !important;
  padding: 12px 14px 24px !important;
  margin: 0 !important;
}

/* —— Top bar —— */
.pd-app-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12000;
  background: var(--pd-black);
  color: #fff;
  padding-top: var(--pd-safe-t);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pd-app-top-inner {
  height: var(--pd-top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
}

.pd-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pd-app-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  background: #000;
  flex-shrink: 0;
}

.pd-app-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.pd-app-product {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pd-blue);
}

.pd-app-page {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-app-icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pd-app-icon-btn:active {
  background: rgba(0, 128, 255, 0.35);
}

/* —— Tab bar —— */
.pd-app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12000;
  height: calc(var(--pd-tabbar-h) + var(--pd-safe-b));
  padding: 6px 4px var(--pd-safe-b);
  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
}

.pd-tab {
  flex: 1;
  max-width: 80px;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px;
  -webkit-tap-highlight-color: transparent;
}

.pd-tab i {
  font-size: 18px;
  line-height: 1;
}

.pd-tab.is-active {
  color: var(--pd-blue);
}

.pd-tab:active {
  opacity: 0.75;
}

/* —— More sheet —— */
.pd-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 13000;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pd-sheet-backdrop.is-open {
  opacity: 1;
}

.pd-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 13001;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + var(--pd-safe-b));
  transform: translateY(110%);
  transition: transform 0.22s ease;
  max-height: 78vh;
  overflow-y: auto;
}

.pd-sheet.is-open {
  transform: translateY(0);
}

.pd-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: #d1d5db;
  margin: 6px auto 14px;
}

.pd-sheet-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 16px;
  border-bottom: 1px solid var(--pd-border);
  margin-bottom: 8px;
}

.pd-sheet-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #111;
  color: var(--pd-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.pd-sheet-user strong {
  display: block;
  font-size: 15px;
  color: var(--pd-text);
}

.pd-sheet-user span {
  font-size: 12px;
  color: var(--pd-muted);
}

.pd-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 10px;
  border-radius: 12px;
  color: var(--pd-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.pd-sheet-item i {
  width: 22px;
  color: var(--pd-blue);
  text-align: center;
}

.pd-sheet-item:active {
  background: #f3f4f6;
}

.pd-sheet-danger {
  color: var(--pd-danger) !important;
}

.pd-sheet-danger i {
  color: var(--pd-danger) !important;
}

.pd-sheet-close {
  width: 100%;
  margin-top: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: #111;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}

/* —— Sayfa içerik sadeleştirme —— */
body.pd-mobile-app .calendar-header {
  flex-direction: column;
  align-items: stretch !important;
  gap: 10px;
}

body.pd-mobile-app .calendar-view-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  width: 100%;
}

body.pd-mobile-app .calendar-view-btn {
  min-height: 42px;
  font-size: 12px !important;
}

body.pd-mobile-app .calendar-stats-bar {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

body.pd-mobile-app .calendar-stats-bar .cal-stats-period {
  grid-column: 1 / -1;
}

body.pd-mobile-app .reminder-card {
  background: var(--pd-card);
  border: 1px solid var(--pd-border);
  border-radius: var(--pd-radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.pd-mobile-app .reminder-header {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px;
}

body.pd-mobile-app .reminder-actions {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: none !important;
}

body.pd-mobile-app .reminder-actions .calendar-picker {
  grid-column: 1 / -1;
}

body.pd-mobile-app .reminder-actions .btn,
body.pd-mobile-app .reminder-actions .btn-sm {
  min-height: 42px;
  justify-content: center;
  margin: 0 !important;
}

body.pd-mobile-app .filter-row,
body.pd-mobile-app .search-form {
  flex-direction: column !important;
  width: 100% !important;
}

body.pd-mobile-app .filter-group {
  width: 100% !important;
  min-width: 0 !important;
}

/* Split desktop force: yan yana filtre */
html.pd-force-desktop body.pd-mobile-app .filter-row,
html.pd-force-desktop .filter-row {
  flex-direction: row !important;
  flex-wrap: nowrap !important;
}
html.pd-force-desktop body.pd-mobile-app .filter-group,
html.pd-force-desktop .filter-group {
  width: auto !important;
  flex: 1 1 0 !important;
}

body.pd-mobile-app table.data-table,
body.pd-mobile-app table.kesif-table {
  font-size: 12px;
}

body.pd-mobile-app .export-buttons {
  display: none !important;
}

/* —— App Login —— */
body.pd-app-login {
  margin: 0;
  min-height: 100dvh;
  background: var(--pd-black);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: calc(24px + var(--pd-safe-t)) 20px calc(24px + var(--pd-safe-b));
  box-sizing: border-box;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.pd-login {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.pd-login-hero {
  text-align: center;
  margin-bottom: 28px;
}

.pd-login-hero img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 14px;
}

.pd-login-hero h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.pd-login-hero p {
  margin: 0;
  color: #9ca3af;
  font-size: 14px;
}

.pd-login-card {
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 20px;
}

.pd-login-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #0a0a0a;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.pd-login-seg label {
  position: relative;
  cursor: pointer;
}

.pd-login-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pd-login-seg span {
  display: block;
  text-align: center;
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: #9ca3af;
}

.pd-login-seg input:checked + span {
  background: var(--pd-blue);
  color: #fff;
}

.pd-login-field {
  margin-bottom: 14px;
}

.pd-login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  margin-bottom: 6px;
}

.pd-login-field input {
  width: 100%;
  box-sizing: border-box;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #0a0a0a;
  color: #fff;
  padding: 12px 14px;
  font-size: 16px;
}

.pd-login-field input:focus {
  outline: 2px solid var(--pd-blue);
  border-color: transparent;
}

.pd-login-error {
  background: rgba(220, 38, 38, 0.15);
  color: #fecaca;
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.pd-login-submit {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--pd-blue);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 4px;
}

.pd-login-submit:active {
  background: var(--pd-blue-dim);
}

.pd-login-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: #6b7280;
}
