/* === Design tokens ================================================= */
:root {
  --green-950: #052e16;
  --green-900: #14532d;
  --green-800: #166534;
  --green-700: #15803d;
  --green-600: #16a34a;
  --green-500: #22c55e;
  --green-400: #4ade80;
  --green-200: #bbf7d0;
  --green-100: #dcfce7;
  --green-50:  #f0fdf4;
  --surface:   #ffffff;
  --text:      #0f172a;
  --text-muted:#475569;
  --border:    #d1fae5;
  --radius:    8px;
  --nav-h:     64px;
}

/* === Reset ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--green-50);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Header / Nav ================================================== */
.top {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--green-900);
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  gap: 1rem;
}

.top .brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  flex-shrink: 0;
}
.top .brand img {
  height: 38px;
  width: auto;
  display: block;
}
.top .brand-text {
  font-weight: 700;
  color: #fff;
  font-size: 1.05rem;
  letter-spacing: -.3px;
}

/* === Hamburger ===================================================== */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 6px;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* === Nav links ===================================================== */
.main-nav {
  display: flex;
  align-items: center;
  gap: .2rem .5rem;
  flex-wrap: wrap;
}
.main-nav a {
  color: #d1fae5;
  text-decoration: none;
  font-size: .875rem;
  padding: .35rem .7rem;
  border-radius: var(--radius);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.main-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }

/* === Lang switcher ================================================= */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  padding: 2px;
  gap: 1px;
}
.lang-switcher a {
  font-size: .78rem !important;
  font-weight: 700 !important;
  padding: .2rem .55rem !important;
  border-radius: 14px !important;
  color: #d1fae5 !important;
  letter-spacing: .03em;
  background: transparent;
  transition: background .15s, color .15s;
}
.lang-switcher a.lang-active {
  background: var(--green-500) !important;
  color: #fff !important;
}
.lang-switcher a:hover:not(.lang-active) {
  background: rgba(255,255,255,.15) !important;
  color: #fff !important;
}

/* === Nav logout button ============================================= */
.nav-logout {
  background: rgba(255,255,255,.12) !important;
  color: #d1fae5 !important;
  border: 1px solid rgba(255,255,255,.22) !important;
  padding: .3rem .8rem !important;
  font-size: .85rem !important;
  font-weight: 500 !important;
  border-radius: var(--radius) !important;
  cursor: pointer;
  transition: background .15s !important;
  white-space: nowrap;
}
.nav-logout:hover { background: rgba(255,255,255,.22) !important; }

/* === Mobile nav ==================================================== */
@media (max-width: 700px) {
  .nav-toggle { display: flex; }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--green-900);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem 1.5rem;
    gap: .4rem;
    box-shadow: 0 6px 16px rgba(0,0,0,.3);
    border-top: 1px solid rgba(255,255,255,.08);
  }
  .main-nav.open { display: flex; }
  .main-nav a { font-size: .95rem !important; padding: .55rem .75rem !important; width: 100%; }
  .lang-switcher { margin-top: .25rem; }
  .nav-logout { margin-top: .25rem; }
}

/* === Main container ================================================ */
main.container {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1rem;
  flex: 1;
  width: 100%;
}

/* === Auth card ===================================================== */
.auth-card {
  max-width: 420px;
  margin: 3rem auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 4px 28px rgba(22,101,52,.10);
}
.auth-logo {
  display: block;
  margin: 0 auto 1.75rem;
  max-height: 52px;
  width: auto;
}
.auth-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--green-900);
  text-align: center;
}
.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius);
  padding: .6rem .875rem;
  font-size: .875rem;
  margin-bottom: 1.25rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: .875rem;
  color: var(--text-muted);
}
.auth-footer a { color: var(--green-700); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* === Forms ========================================================= */
label { display: block; margin: 0 0 1rem; font-size: .875rem; font-weight: 500; color: var(--text); }
label > span { display: block; margin-bottom: .35rem; }
input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: .6rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  background: #fff;
  color: var(--text);
  max-width: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
input[type="checkbox"] { width: auto; margin-right: .4rem; }

/* === Buttons ======================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--green-600);
  color: #fff;
  border: none;
  padding: .625rem 1.25rem;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--green-700); transform: translateY(-1px); }
.btn-full { width: 100%; }
.btn-sm { padding: .4rem .85rem; font-size: .85rem; }

button[type="submit"]:not(.nav-logout),
button[type="button"]:not(.nav-toggle):not(.nav-logout) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--green-600);
  color: #fff;
  border: none;
  padding: .6rem 1.2rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
button[type="submit"]:not(.nav-logout):hover,
button[type="button"]:not(.nav-toggle):not(.nav-logout):hover {
  background: var(--green-700);
}
.inline { display: inline; margin: 0; padding: 0; }

/* === Tables ======================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
th {
  background: var(--green-50);
  color: var(--green-900);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
th, td { padding: .625rem 1rem; border-bottom: 1px solid var(--green-50); text-align: left; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--green-50); }

/* === Page section card ============================================= */
.page-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(22,101,52,.07);
  margin-bottom: 1.5rem;
}
.page-section h1,
.page-section h2 {
  margin-top: 0;
  color: var(--green-900);
}

/* === Error box ===================================================== */
.error-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.error-box code {
  background: #fee2e2;
  padding: .1rem .35rem;
  border-radius: 3px;
  font-size: .85rem;
}
.error-box a { color: var(--green-700); font-weight: 500; }

/* === Drop zone ===================================================== */
.drop-zone {
  border: 2px dashed var(--green-400);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-bottom: .75rem;
}
.drop-zone:hover,
.drop-zone.drag-over {
  background: var(--green-50);
  border-color: var(--green-600);
  color: var(--green-700);
}
.drop-zone p { margin: 0; font-size: .9rem; pointer-events: none; }

.drop-zone.locked {
  opacity: 0.55;
  background: #f8fafc;
  border-color: #cbd5e1;
  cursor: not-allowed;
}
.drop-zone.locked:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* === Send page ===================================================== */
.send-field {
  margin-bottom: .75rem;
}
.send-field label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .2rem;
}
.send-check-label {
  display: flex !important;
  align-items: center;
  gap: .4rem;
  font-weight: 400 !important;
  cursor: pointer;
}

/* Top header bar for "Yeni Gönder" button */
.send-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
  min-height: 36px;
}
.send-header #new-send-btn {
  font-size: 0.875rem;
  padding: 0.35rem 0.9rem;
  white-space: nowrap;
}

/* === Proper Tabs (E-posta / Bağlantı) ============================== */
.send-tabs {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.send-tab {
  background: transparent;
  border: none;
  padding: .45rem 1.1rem;
  font-size: .9rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  border-radius: 6px;
  transition: all .15s ease;
}
.send-tab:hover {
  color: #1e2937;
}
.send-tab.active {
  background: white;
  color: var(--green-700);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 600;
}
.send-tab-panel {
  min-height: 3.5rem;
}

/* Badge input */
.badge-input {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .35rem .5rem;
  cursor: text;
  min-height: 2.4rem;
}
.badge-input input {
  border: none;
  outline: none;
  flex: 1;
  min-width: 8rem;
  font-size: .875rem;
  background: transparent;
  padding: .1rem 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: var(--green-50);
  color: var(--green-700);
  border: 1px solid var(--green-200);
  border-radius: 999px;
  padding: .15rem .55rem;
  font-size: .8rem;
  white-space: nowrap;
}
.badge button {
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  color: var(--green-600);
  font-size: .75rem;
}
.badge button:hover { color: #b91c1c; }

/* === Upload jobs =================================================== */
.upload-job {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  margin-bottom: .5rem;
  background: var(--surface);
}
.upload-job-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .2rem;
}
.upload-job-active { min-height: 1.1em; }
.upload-job-file {
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#upload-jobs progress {
  height: 6px;
  border-radius: 3px;
  accent-color: var(--green-600);
}

/* Send page progress bar */
#upload-progress progress {
  height: 8px;
  border-radius: 4px;
  accent-color: var(--green-600);
  width: 100%;
}

/* === Floating Toast (Send page) ==================================== */
.send-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #166534;
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 9999;
  animation: toastSlideIn 0.25s ease forwards;
}
.send-toast.fade-out {
  animation: toastFadeOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(8px); }
}

/* === Status / Error ================================================ */
.error { color: #b91c1c; font-size: .875rem; margin: .5rem 0; }
#upload-status { margin-top: 1rem; font-family: monospace; font-size: .85rem; }

/* === File tree ===================================================== */
.file-tree { list-style: none; padding: 0; }
.file-tree li { padding: .35rem 0; }

/* === Footer ======================================================== */
.site-footer {
  margin-top: auto;
  padding: 2rem 1.5rem;
  background: var(--green-900);
  color: #d1fae5;
}
.site-footer-inner { max-width: 960px; margin: 0 auto; text-align: center; }
.site-footer-brand { margin: 0 0 .25rem; font-weight: 700; color: #fff; }
.site-footer-tagline { margin: 0 0 1rem; font-size: .875rem; color: #86efac; }
.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .5rem 1.25rem;
  margin-bottom: 1rem;
}
.site-footer-nav a { color: var(--green-200); text-decoration: none; font-size: .9rem; }
.site-footer-nav a:hover { color: #fff; }
.site-footer-copy { margin: 0; font-size: .8rem; color: #86efac; }

/* === Shipment History Cards (History page) ========================= */
.shipment-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.shipment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow .15s ease, transform .1s ease;
}
.shipment-card:hover {
  box-shadow: 0 4px 14px rgba(22,101,52,0.08);
}
.shipment-card.expired {
  opacity: 0.85;
  background: #fef2f2;
  border-color: #fecaca;
}

.shipment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .4rem;
}
.shipment-title {
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--green-900);
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shipment-title:hover { text-decoration: underline; }

.status-pill {
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.status-pill.active { background: #dcfce7; color: #166534; }
.status-pill.expired { background: #fee2e2; color: #991b1b; }

.delivery-badges { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .25rem; }
.delivery-badge {
  font-size: .68rem;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.delivery-badge.email { background: #dbeafe; color: #1e40af; }
.delivery-badge.link { background: #e0e7ff; color: #3730a3; }

.shipment-meta { font-size: .875rem; color: var(--text-muted); margin-bottom: .6rem; }
.expires-line .value.expired { color: #b91c1c; font-weight: 500; }

.shipment-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* === Shipment Management Page ===================================== */
.shipment-manage-page .manage-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.shipment-manage-page .info-card,
.shipment-manage-page .card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.shipment-manage-page .info-row {
  display: flex;
  justify-content: space-between;
  margin: .25rem 0;
  font-size: .925rem;
}
.shipment-manage-page .info-row .label { color: var(--text-muted); }

.recipients-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.recipients-table th, .recipients-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--border); text-align: left; font-size: .9rem; }

.form-status { font-size: .85rem; min-height: 1.1em; }
.retention-radios label { display: inline-block; margin: .15rem 0; }
.delivery-chooser label { margin-right: 1rem; font-weight: 500; }

@media (max-width: 640px) {
  .shipment-history-grid { grid-template-columns: 1fr; }
  .shipment-manage-page .manage-header { flex-direction: column; }
}
