/* ==========================================================================
   Teedia — Design System
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Afacad:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Fira+Sans:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&display=swap");

/* --------------------------------------------------------------------------
   Variables
   -------------------------------------------------------------------------- */
:root {
  /* Fonts */
  --font-body: "Fira Sans", sans-serif;
  --font-title: "Afacad", sans-serif;

  /* Main — International Klein Blue (hue 223) */
  --mDarker: hsl(223, 100%, 20%);
  --mDark: hsl(223, 100%, 35%);
  --mBrilliant: hsl(223, 100%, 50%);
  --m100: #0d4ef2;
  --m80: hsl(223, 90.2%, 60%);
  --m60: hsl(223, 89.5%, 70%);
  --m40: hsl(223, 90.2%, 80%);
  --m30: hsl(223, 89.6%, 84.9%);
  --m20: hsl(223, 88.2%, 90%);
  --m15: hsl(224, 89.5%, 92.5%);
  --m10: hsl(224, 92%, 95.1%);
  --m5: hsl(224, 84.6%, 97.5%);
  --m3: hsl(225, 50%, 98.4%);
  --m100t: hsla(223, 89.8%, 50%, 1);
  --m80t: hsla(223, 90.2%, 50%, 0.8);
  --m60t: hsla(223, 89.5%, 50%, 0.6);
  --m40t: hsla(223, 90.2%, 50%, 0.4);
  --m30t: hsla(223, 90.8%, 49.7%, 0.3);
  --m20t: hsla(223, 88.2%, 50%, 0.2);
  --m15t: hsla(223, 91%, 49.5%, 0.15);
  --m10t: hsla(223, 91.5%, 50.5%, 0.1);
  --m8t: hsla(223, 90%, 50.2%, 0.08);
  --m5t: hsla(223, 85.6%, 49.5%, 0.05);
  --m3t: hsla(223, 58.1%, 46.2%, 0.03);

  /* Secondary — Purple (hue 280) */
  --sDarker: hsl(280, 100%, 20%);
  --sDark: hsl(280, 100%, 35%);
  --sBrilliant: hsl(280, 100%, 50%);
  --s100: #a60df2;
  --s80: hsl(280, 90%, 60%);
  --s60: hsl(280, 90%, 70%);
  --s40: hsl(280, 90%, 80%);
  --s30: hsl(280, 90%, 85%);
  --s20: hsl(280, 90%, 90%);
  --s15: hsl(280, 90%, 92.5%);
  --s10: hsl(280, 90%, 95%);
  --s5: hsl(280, 90%, 97.5%);
  --s3: hsl(280, 90%, 98.5%);
  --s100t: hsla(280, 90%, 50%, 1);
  --s80t: hsla(280, 90%, 50%, 0.8);
  --s60t: hsla(280, 90%, 50%, 0.6);
  --s40t: hsla(280, 90%, 50%, 0.4);
  --s30t: hsla(280, 90%, 50%, 0.3);
  --s20t: hsla(280, 90%, 50%, 0.2);
  --s15t: hsla(280, 90%, 50%, 0.15);
  --s10t: hsla(280, 90%, 50%, 0.1);
  --s5t: hsla(280, 90%, 50%, 0.05);
  --s3t: hsla(280, 90%, 50%, 0.03);

  /* Tertiary — Pink (hue 338) */
  --teDarker: hsl(338, 100%, 20%);
  --teDark: hsl(338, 100%, 35%);
  --teBrilliant: hsl(338, 100%, 50%);
  --te100: #f20d61;
  --te80: hsl(338, 90%, 60%);
  --te60: hsl(338, 90%, 70%);
  --te40: hsl(338, 90%, 80%);
  --te30: hsl(338, 90%, 85%);
  --te20: hsl(338, 90%, 90%);
  --te15: hsl(338, 90%, 92.5%);
  --te10: hsl(338, 90%, 95%);
  --te5: hsl(338, 90%, 97.5%);
  --te3: hsl(338, 90%, 98.5%);
  --te100t: hsla(338, 90%, 50%, 1);
  --te80t: hsla(338, 90%, 50%, 0.8);
  --te60t: hsla(338, 90%, 50%, 0.6);
  --te40t: hsla(338, 90%, 50%, 0.4);
  --te30t: hsla(338, 90%, 50%, 0.3);
  --te20t: hsla(338, 90%, 50%, 0.2);
  --te15t: hsla(338, 90%, 50%, 0.15);
  --te10t: hsla(338, 90%, 50%, 0.1);
  --te5t: hsla(338, 90%, 50%, 0.05);
  --te3t: hsla(338, 90%, 50%, 0.03);

  /* Dark — bluish gray (hue 223) */
  --dDarker: hsl(223, 20%, 1%);
  --dDark: hsl(223, 20%, 5%);
  --dBrilliant: hsl(223, 20%, 50%);
  --d100: hsl(224, 39.2%, 20%);
  --d80: hsl(223, 17.4%, 36.1%);
  --d60: hsl(225, 9.8%, 52.2%);
  --d40: hsl(221, 9.8%, 67.8%);
  --d30: hsl(225, 9.8%, 76.1%);
  --d20: hsl(225, 9.8%, 83.9%);
  --d15: hsl(220, 9.7%, 87.8%);
  --d10: hsl(225, 10%, 92.2%);
  --d8: hsl(225, 10%, 94.2%);
  --d5: hsl(240, 10%, 96.1%);
  --d3: hsl(180, 7.7%, 97.5%);
  --d100t: hsla(223, 40%, 20%, 1);
  --d80t: hsla(223, 40%, 20%, 0.8);
  --d60t: hsla(223, 40%, 20%, 0.6);
  --d40t: hsla(223, 40%, 20%, 0.4);
  --d30t: hsla(223, 40%, 20%, 0.3);
  --d20t: hsla(223, 40%, 20%, 0.2);
  --d15t: hsla(223, 40%, 20%, 0.15);
  --d10t: hsla(223, 40%, 20%, 0.1);
  --d8t: hsla(223, 40%, 20%, 0.08);
  --d5t: hsla(223, 40%, 20%, 0.05);
  --d3t: hsla(223, 40%, 20%, 0.03);

  /* Semantic shortcuts */
  --bg-page: linear-gradient(
    160deg,
    var(--m5t),
    var(--m10t) 50%,
    var(--s10t) 75%,
    var(--te10t) 100%
  );
  --bg-card: #ffffff;
  --text-body: var(--d80t);
  --text-strong: var(--d100);
  --border-color: var(--d10t);
  --border-color-hover: var(--m40t);

  --radius: 16px;
  --radius-sm: 8px;
  --radius-xs: 4px;

  --shadow-card: 0 2px 16px var(--d5t), 0 1px 4px var(--d8t);
  --shadow-card-hover: 0 6px 32px var(--m10t), 0 2px 8px var(--d8t);

  --transition: 0.2s ease;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  color: var(--text-body);
  background: var(--bg-page);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
}

p {
  color: var(--text-body);
}
strong,
b {
  color: var(--text-strong);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
.t-page-title {
  background: linear-gradient(
    in oklch 45deg,
    var(--m100) 40%,
    var(--s100) 75%,
    var(--te100) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: var(--font-title);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
}

.t-section-title {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 600;
  color: var(--d100);
  line-height: 1.3;
}

.t-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--d60);
}

.t-muted {
  font-size: 13px;
  color: var(--d60);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 32px;
}

.container--narrow {
  max-width: 520px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  height: 80px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(in oklch 90deg, var(--m100) 0%, var(--s100) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-user {
  font-size: 13px;
  color: var(--d60);
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

.card--sm {
  padding: 24px;
}
.card--lg {
  padding: 40px;
}

.card--interactive {
  cursor: pointer;
  transition:
    box-shadow var(--transition),
    border-color var(--transition),
    transform var(--transition);
}
.card--interactive:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-color-hover);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Inputs
   -------------------------------------------------------------------------- */
.input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--d100);
  background: white;
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--m60t);
  box-shadow: 0 0 0 3px var(--m10t);
}
.input::placeholder {
  color: var(--d30);
}

.input-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--d80);
  margin-bottom: 8px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.input-row {
  display: flex;
  gap: 8px;
}
.input-row .input {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}

.btn--primary {
  background: var(--m100);
  color: white;
  box-shadow: 0 2px 8px var(--m40t);
}
.btn--primary:hover {
  background: var(--mDark);
  box-shadow: 0 4px 16px var(--m40t);
  transform: translateY(-1px);
}
.btn--primary:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--d60);
  border: 1.5px solid var(--border-color);
}
.btn--ghost:hover {
  background: var(--m5t);
  border-color: var(--m30t);
  color: var(--m100);
}

.btn--danger {
  background: transparent;
  color: hsl(338, 70%, 45%);
  border: 1.5px solid hsl(338, 60%, 88%);
  font-size: 12px;
  padding: 6px 14px;
}
.btn--danger:hover {
  background: var(--te5);
  border-color: hsl(338, 60%, 75%);
}

.btn--full {
  width: 100%;
}
.btn--lg {
  padding: 15px 32px;
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   Badge
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.badge--primary {
  background: var(--m10t);
  color: var(--m100);
  border: 1px solid var(--m20t);
}

/* --------------------------------------------------------------------------
   Messages (alerts)
   -------------------------------------------------------------------------- */
.msg {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid transparent;
}

.msg--success {
  background: hsl(140, 60%, 96%);
  border-color: hsl(140, 50%, 82%);
  color: hsl(140, 50%, 28%);
}

.msg--error {
  background: var(--te5);
  border-color: var(--te20);
  color: var(--teDark);
}

/* --------------------------------------------------------------------------
   Stat block
   -------------------------------------------------------------------------- */
.stat-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-block__value {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 600;
  color: var(--d100);
  line-height: 1;
}
.stat-block__label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--d40);
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--d30);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* --------------------------------------------------------------------------
   Drawer
   -------------------------------------------------------------------------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--d40t);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 440px;
  max-width: 95vw;
  background: white;
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow:
    -8px 0 48px var(--m15t),
    -2px 0 8px var(--d8t);
}
.drawer.open {
  transform: translateX(0);
}

.drawer__header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.drawer__title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
  color: var(--d100);
  line-height: 1.3;
  word-break: break-all;
}
.drawer__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--d40);
  padding: 2px;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--transition);
  border-radius: var(--radius-xs);
}
.drawer__close:hover {
  color: var(--d100);
  background: var(--d5t);
}

.drawer__stats {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.drawer__stat {
  flex: 1;
  padding: 20px;
  text-align: center;
  border-right: 1px solid var(--border-color);
}
.drawer__stat:last-child {
  border-right: none;
}
.drawer__stat-value {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(
    in oklch 45deg,
    var(--m100) 40%,
    var(--s100) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.drawer__stat-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--d40);
  margin-top: 4px;
}

.drawer__section-label {
  padding: 16px 28px 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--d40);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 28px 32px;
}

.drawer__empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--d40);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   History list (inside drawer)
   -------------------------------------------------------------------------- */
.history-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--d3t);
  align-items: flex-start;
}
.history-item:last-child {
  border-bottom: none;
}

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--m100), var(--s100));
  flex-shrink: 0;
  margin-top: 5px;
}

.history-file {
  font-size: 13px;
  font-weight: 500;
  color: var(--d100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.history-date {
  font-size: 12px;
  color: var(--d40);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  .site-header {
    padding: 0 16px;
  }
  .card {
    padding: 24px;
  }
  .card--lg {
    padding: 24px;
  }
}
