/* static/css/theme.css */

@font-face {
  font-family: 'Vazirmatn';
  src: url("../fonts/Vazirmatn/fonts/webfonts/Vazirmatn[wght].f6d31671339d.woff2") format('woff2 supports variations'),
       url("../fonts/Vazirmatn/fonts/webfonts/Vazirmatn[wght].f6d31671339d.woff2") format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

html[data-theme="dark"] {
  --bg-dark: oklch(0.1 0 20);
  --bg: oklch(0.15 0 20);
  --bg-light: oklch(0.2 0 20);
  --text: oklch(0.96 0 20);
  --text-muted: oklch(0.76 0 20);
  --highlight: oklch(0.5 0 20);
  --border: oklch(0.4 0 20);
  --border-muted: oklch(0.3 0 20);
  --primary: oklch(0.76 0.1 20);
  --secondary: oklch(0.76 0.1 200);
  --danger: oklch(0.7 0.05 30);
  --warning: oklch(0.7 0.05 100);
  --success: oklch(0.7 0.05 160);
  --info: oklch(0.7 0.05 260);
}

html[data-theme="light"] {
  --bg-dark: oklch(0.92 0 20);
  --bg: oklch(0.96 0 20);
  --bg-light: oklch(1 0 20);
  --text: oklch(0.15 0 20);
  --text-muted: oklch(0.4 0 20);
  --highlight: oklch(1 0 20);
  --border: oklch(0.6 0 20);
  --border-muted: oklch(0.7 0 20);

  --primary: oklch(0.4 0.1 20);
  --secondary: oklch(0.4 0.1 200);
  --danger: #b85c52;
  --warning: oklch(0.5 0.05 100);
  --success: oklch(0.5 0.05 160);
  --info: oklch(0.5 0.05 260);
}

@media (prefers-color-scheme: light) {
  html[data-theme="auto"] {
    --bg-dark: oklch(0.92 0 20);
    --bg: oklch(0.96 0 20);
    --bg-light: oklch(1 0 20);
    --text: oklch(0.15 0 20);
    --text-muted: oklch(0.4 0 20);
    --highlight: oklch(1 0 20);
    --border: oklch(0.6 0 20);
    --border-muted: oklch(0.7 0 20);

    --primary: oklch(0.4 0.1 20);
    --secondary: oklch(0.4 0.1 200);
    --danger: #b85c52;
    --warning: oklch(0.5 0.05 100);
    --success: oklch(0.5 0.05 160);
    --info: oklch(0.5 0.05 260);
  }
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg-dark: oklch(0.1 0 20);
    --bg: oklch(0.15 0 20);
    --bg-light: oklch(0.2 0 20);
    --text: oklch(0.96 0 20);
    --text-muted: oklch(0.76 0 20);
    --highlight: oklch(0.5 0 20);
    --border: oklch(0.4 0 20);
    --border-muted: oklch(0.3 0 20);
    --primary: oklch(0.76 0.1 20);
    --secondary: oklch(0.76 0.1 200);
    --danger: oklch(0.7 0.05 30);
    --warning: oklch(0.7 0.05 100);
    --success: oklch(0.7 0.05 160);
    --info: oklch(0.7 0.05 260);
  }
}

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

* {
  -webkit-tap-highlight-color: transparent !important;
}


body, input, button, a {
  font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
a {
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
ul { list-style: none; }

body {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.8;
  color: var(--text);
  background-color: var(--bg);
}
@media (max-width: 768px) {
  body {
    background-color: var(--bg-light);
  }
  
}

/* directions */

/* Only affects the main content, not the navbar */
.rtl-content {
    direction: rtl;
    text-align: right;
}

.rtl-content p,
.rtl-content h1,
.rtl-content h2,
.rtl-content h3,
.rtl-content h4,
.rtl-content h5,
.rtl-content h6,
.rtl-content span,
.rtl-content div {
    direction: rtl;
    text-align: right;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

/* ── Toast Messages ── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    width: min(calc(100% - 2rem), 34rem);
}

.toast {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    direction: rtl;
    padding: 0.6rem 0.85rem;
    border-radius: 0.45rem;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 1;
    animation: toast-in 0.3s ease;
    transition: transform 0.3s ease;
    pointer-events: auto;
    white-space: normal;
    line-height: 1.5;
    overflow-wrap: anywhere;
    text-align: right;
    touch-action: pan-y;
}

.toast > span:first-child {
    flex: 1;
}

.toast--timed::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    opacity: 0.65;
    transform-origin: right center;
    animation: toast-timer var(--toast-duration, 5000ms) linear forwards;
}

.toast__action {
    flex: 0 0 auto;
    padding: 0.2rem 0.45rem;
    border: 0;
    border-bottom: 1px solid currentColor;
    color: inherit;
    background: transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.toast__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 50%;
    color: inherit;
    background: transparent;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.7;
}

.toast__close:hover {
    opacity: 1;
}

.toast--success {
    color: var(--success);
}

.toast--error {
    color: var(--danger);
}

.toast--warning {
    color: var(--warning);
}

.toast--info {
    color: var(--info);
}

.toast.removing {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

@keyframes toast-timer {
    to { transform: scaleX(0); }
}

@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: 1.5rem;
        left: auto;
        right: 1rem;
        transform: none;
        direction: rtl;
        align-items: flex-start;
    }

    .toast {
        width: auto;
        max-width: calc(100vw - 2rem);
    }
}
