/* ==========================================================================
   PawPal shared design system — tokens + base components.
   Loaded on every page BEFORE the page-specific stylesheet, which only
   needs to handle page-specific layout from here on.
   ========================================================================== */

:root {
    --bg: #060608;
    --bg-soft: #0a0d10;
    --surface: rgba(0, 255, 204, 0.07);
    --surface-strong: rgba(0, 255, 204, 0.14);
    --border: rgba(0, 255, 204, 0.25);
    --border-strong: rgba(0, 255, 204, 0.45);

    --accent: #00ffcc;
    --accent-2: #00e0b8;
    --accent-ink: #001510;

    --success: #00ff99;
    --warning: #ffcc00;
    --danger: #ff4d4d;

    --text: #f5f7f7;
    --text-dim: #9fb0ae;
    --text-faint: #6b7876;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-pill: 999px;

    --shadow-soft: 0 8px 30px rgba(0, 0, 0, 0.45);
    --glow-sm: 0 0 16px rgba(0, 255, 204, 0.18);
    --glow-md: 0 0 32px rgba(0, 255, 204, 0.22);

    --ease: cubic-bezier(.22, 1, .36, 1);
    --font: "Segoe UI", Tahoma, "Vazirmatn", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

body {
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 255, 204, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 255, 204, 0.05), transparent);
    background-attachment: fixed;
}

::selection {
    background: rgba(0, 255, 204, 0.35);
    color: #fff;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 204, 0.25);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 204, 0.45);
}

a {
    color: var(--accent);
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* ================= GLASS PANEL / CARD ================= */

.panel,
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-soft);
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

.panel:hover,
.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-soft), var(--glow-md);
}

/* ================= BUTTONS ================= */

button, .button, .btn {
    font-family: var(--font);
    width: 100%;
    padding: 13px 18px;
    margin-top: 10px;
    border: none;
    border-radius: var(--radius-sm);

    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: var(--accent-ink);

    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.2px;
    cursor: pointer;

    box-shadow: 0 4px 16px rgba(0, 255, 204, 0.15);
    transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), filter 0.18s var(--ease);
}

button:hover, .button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 255, 204, 0.3);
    filter: brightness(1.05);
}

button:active, .button:active, .btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 255, 204, 0.2);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: none;
    transform: none;
}

.success { background: linear-gradient(135deg, var(--success), #00cc7a); color: #002015; }
.danger, .shoot { background: linear-gradient(135deg, var(--danger), #cc2b2b); color: #fff; }
.warning { background: linear-gradient(135deg, var(--warning), #e0a800); color: #201800; }

/* ================= INPUTS ================= */

input[type="text"],
input[type="password"],
input[type="number"],
input[type="time"],
input {
    font-family: var(--font);
    width: 100%;
    padding: 12px 14px;
    margin: 6px 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

input::placeholder {
    color: var(--text-faint);
}

input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(0, 255, 204, 0.15);
}

input[type="range"] {
    accent-color: var(--accent);
}

/* ================= TOGGLE SWITCH ================= */

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background 0.3s var(--ease);
}

.slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s var(--ease);
}

.switch input:checked + .slider {
    background: var(--accent);
    box-shadow: var(--glow-sm);
}

.switch input:checked + .slider:before {
    transform: translateX(22px);
}

/* ================= STATUS TEXT / DOTS ================= */

.status {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-dim);
}

#dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.green { background: var(--success); box-shadow: 0 0 10px var(--success); }
.yellow { background: var(--warning); box-shadow: 0 0 10px var(--warning); }
.red { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* ================= TITLE ================= */

.title, .page-title {
    text-align: center;
    color: var(--accent);
    margin-bottom: 30px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-shadow: 0 0 12px rgba(0, 255, 204, 0.55), 0 0 30px rgba(0, 255, 204, 0.25);
}

/* ================= SHARED LAYOUT HELPERS ================= */

.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s var(--ease);
}

.back-link:hover {
    color: var(--accent);
    border-color: var(--border);
    background: var(--surface);
}

.status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.sub-label {
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 13px;
}

.center-block {
    text-align: center;
}

.center-block h3 {
    margin-bottom: 14px;
}

/* ================= LIVE CLOCK ================= */

.live-clock {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 20;

    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;

    padding: 7px 16px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.live-clock-time {
    color: var(--accent);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
}

.live-clock-date {
    color: var(--text-dim);
    font-size: 10px;
    margin-top: 1px;
}

/* ================= CAMERA FULLSCREEN ================= */

.camera-wrap {
    position: relative;
}

.fullscreen-btn {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    z-index: 5;

    width: auto;
    margin: 0;
    padding: 6px 12px;

    font-size: 12px;
    font-weight: 600;

    background: rgba(0, 0, 0, 0.55);
    color: var(--accent);
    border: 1px solid var(--border);
    box-shadow: none;
    backdrop-filter: blur(6px);
}

.fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: none;
    box-shadow: none;
}

.camera-frame:fullscreen {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    background: #000;
}

/* ================= MOBILE ================= */

@media (max-width: 560px) {
    .live-clock {
        top: 10px;
        right: 10px;
        padding: 5px 12px;
    }

    .live-clock-time {
        font-size: 13px;
    }

    .live-clock-date {
        font-size: 9px;
    }

    .back-link {
        top: 10px;
        left: 10px;
        font-size: 12px;
        padding: 5px 12px;
    }

    .title, .page-title {
        font-size: 21px;
    }

    button, .button, .btn {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    /* جا برای back-link/live-clock ثابت‌شده در گوشه‌ها باز بمونه */
    .header {
        padding-inline: 90px;
    }

    .header h2 {
        font-size: 15px;
    }
}

/* ================= BACKGROUND CANVAS ================= */

#bgCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ================= SCROLL-IN ANIMATION ================= */

@keyframes pawpal-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel, .card {
    animation: pawpal-fade-up 0.5s var(--ease) both;
}
