/* ===============================
   RESET
================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===============================
   THEME VARIABLES
================================ */
:root {
    /* Dark (default) */
    --bg-main: #14161a;
    --bg-card: rgba(25, 27, 31, 0.92);
    --bg-input: #fef9a5;
    --bg-hash: #0f1115;
    --bg-output: #f3f6fb;

    --text-main: #ffffff;
    --text-muted: #b7b7b7;

    --accent: #f7d046;
    --shadow-card: 0 30px 60px rgba(0, 0, 0, 0.15);
}

body.light {
    --bg-main: #f4f6f8;
    --bg-card: #fdfefe;
    --bg-input: #fafafa;
    --bg-hash: #f1f3f5;

    --text-main: #111827;
    --text-muted: #6b7280;

    --accent: #b89b00;
}

/* ===============================
   PAGE BACKGROUND
================================ */
body {
    min-height: 100vh;
    font-family: Arial, sans-serif;
    color: var(--text-main);

    display: flex;
    justify-content: center;
    align-items: center;

    background:
        radial-gradient(
            ellipse at top center,
            #ffffff 0%,
            #eef0f4 45%,
            #dfe3e8 100%
        );

    transition:
        background 0.4s ease,
        color 0.3s ease;
}

body:not(.light) {
    background:
        radial-gradient(
            ellipse at top center,
            #2b2f36 0%,
            #1f2125 45%,
            #14161a 100%
        );
}

body.light {
    background:
        radial-gradient(
            ellipse at center,
            #f8fafc 0%,
            #eef2f7 55%,
            #e5eaf1 100%
        );
}

/* ===============================
   APP CONTAINER
================================ */
.app {
    position: relative;
    width: 720px;
    max-width: 94%;
    max-height: 88vh;

    overflow-y: auto;
    padding: 32px 28px;

    background: var(--bg-card);
    border-radius: 24px;

    border: 1px solid rgba(0, 0, 0, 0.08);

    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(0, 0, 0, 0.04);

    backdrop-filter: blur(8px);
    will-change: transform, opacity;

    animation: appEnter 0.45s ease-out forwards;
}

/* ===============================
   ENTRY ANIMATION
================================ */
@keyframes appEnter {
    from {
        opacity: 0;
        transform: scale(0.98) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ===============================
   MICRO INTERACTIONS (ALREADY GOOD)
================================ */
.app:hover {
    transform: translateY(-2px);
    transition: transform 0.25s ease;
}

textarea,
select {
    transition:
        box-shadow 0.2s ease,
        transform 0.2s ease,
        background 0.2s ease;
}

textarea:hover,
select:hover {
    transform: scale(1.005);
}

.icon-btn {
    transition:
        background 0.2s ease,
        transform 0.15s ease,
        opacity 0.15s ease;
}

.icon-btn:hover {
    transform: scale(1.1);
}

/* ===============================
   ACCESSIBILITY
================================ */
@media (prefers-reduced-motion: reduce) {
    .app {
        animation: none;
    }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}


/* ===============================
   HEADER (STICKY)
================================ */
header {
    position: sticky;
    top: 0;
    z-index: 10;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;

    margin-bottom: 18px;
    padding-bottom: 12px;

    background: color-mix(in srgb, var(--bg-card) 88%, transparent);
    backdrop-filter: blur(6px);
}

body.light header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid #e5e7eb;
}


h1 {
    font-size: 24px;
    color: var(--accent);
}

/* ===============================
   ALGORITHM SELECT
================================ */
.algo-select label {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 6px;
}

.algo-select select {
    background: var(--accent);
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
}

/* ===============================
   THEME TOGGLE
================================ */
.theme-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--accent);

    padding: 6px 10px;
    border-radius: 20px;
    font-size: 14px;

    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

body.light .theme-toggle {
    border: 1px solid #d1d5db;
}

body.light .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ===============================
   TEXTAREA INPUT
================================ */
textarea {
    width: 100%;
    height: 170px;
    margin-top: 16px;
    padding: 14px;

    background: var(--bg-input);
    border-radius: 14px;

    border: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 15px;
    resize: none;
    outline: none;
}

body.light textarea {
    border: 1px solid #d1d5db;
    background: #ffffff;
}

body.light textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(184, 155, 0, 0.15);
}

/* ===============================
   RESULT SECTION
================================ */
.result {
    margin-top: 22px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.label {
    font-size: 13px;
    color: var(--accent);
}

/* ===============================
   BADGES
================================ */
.badges {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 20px;
    font-weight: bold;
}

.badge.secure {
    background: #22c55e;
    color: #000;
}

.badge.legacy {
    background: #f97316;
    color: #000;
}

body.light .badge.secure {
    background: #22c55e;
    color: #ffffff;
}

body.light .badge.legacy {
    background: #f97316;
    color: #ffffff;
}

/* ===============================
   HASH OUTPUT BOX
================================ */
.hash-box {
    position: relative;
    background: var(--bg-hash);
    border-radius: 10px;

    padding: 12px 44px 12px 14px;
    margin-top: 8px;

    max-height: 90px;
    overflow-y: auto;
}

body.light .hash-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

body.light #hashOutput {
    color: #92400e; /* readable amber */
}

#hashOutput {
    font-size: 13px;
    line-height: 1.4;
    color: var(--accent);

    word-break: break-all;
    font-family: monospace;
}

.hash-box.updated {
  animation: pulse 0.25s ease;
}
@keyframes pulse {
  from { opacity: 0.6; }
  to { opacity: 1; }
}


/* ===============================
   COPY BUTTON
================================ */
.icon-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);

    background: transparent;
    border: none;
    cursor: pointer;

    padding: 6px;
    border-radius: 6px;
    opacity: 0.75;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    fill: var(--accent);
}

.icon-btn:hover {
    background: rgba(247, 208, 70, 0.15);
    opacity: 1;
}

.icon-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===============================
   TOAST
================================ */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);

    background: var(--bg-hash);
    color: var(--accent);

    padding: 10px 18px;
    border-radius: 20px;

    font-size: 13px;
    opacity: 0;
    pointer-events: none;

    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===============================
   FOOTER
================================ */
footer {
    margin-top: 26px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===============================
   SEO COLLAPSIBLE
================================ */
.seo-wrapper {
    margin-top: 36px;
    padding-top: 20px;

    /* clear separation */
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

body.light .seo-wrapper {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.seo-toggle {
    background: transparent;
    border: none;

    color: var(--accent);
    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
    padding: 6px 0;

    display: inline-flex;
    align-items: center;
    gap: 6px;

    opacity: 0.85;
    transition: opacity 0.2s ease;
}

.seo-toggle:hover {
    opacity: 1;
    text-decoration: underline;
}


.seo-content {
    margin-top: 12px;
    padding-top: 8px;

    font-size: 13px;
    line-height: 1.6;

    color: var(--text-muted);
    opacity: 0.92;

    overflow: hidden;
    max-height: 800px;

    transition:
        max-height 0.35s ease,
        opacity 0.25s ease;
}

.seo-content.collapsed {
    max-height: 0;
    opacity: 0;
}

.seo-content h2 {
    font-size: 16px;
    margin: 12px 0 6px;
    color: var(--text-main);
}

.seo-content h3 {
    font-size: 14px;
    margin: 10px 0 4px;
    color: var(--text-main);
}

.seo-content ul {
    padding-left: 18px;
    margin-top: 6px;
}

.seo-content li {
    margin-bottom: 4px;
    color: var(--text-muted);
}

body.light .seo-content {
    color: #374151;
}

body.light .seo-content h2,
body.light .seo-content h3 {
    color: #111827;
}


/* ===============================
   MOBILE
================================ */
@media (max-width: 768px) {
    body {
        align-items: flex-start;
        padding: 16px 0;
    }

    .app {
        width: 100%;
        max-height: none;
        border-radius: 18px;
        padding: 22px 18px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
    }

    textarea {
        height: 140px;
    }

    footer {
        text-align: center;
    }
}

/* ===============================
   ACCESSIBILITY
================================ */
@media (prefers-reduced-motion: reduce) {
    .app {
        animation: none;
    }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 6px;
}

body.light h1 {
    color: #8a7400;
}

body.light .label {
    color: #8a7400;
}

/* ===============================
   MICRO INTERACTIONS & MOTION
================================ */

/* App entry animation */
.app {
    animation: appEnter 0.45s ease-out;
}

@keyframes appEnter {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Hover lift for main card */
.app:hover {
    transform: translateY(-2px);
    transition: transform 0.25s ease;
}

/* Inputs hover & focus */
textarea,
select {
    transition:
        box-shadow 0.2s ease,
        transform 0.2s ease,
        background 0.2s ease;
}

textarea:hover,
select:hover {
    transform: scale(1.005);
}

textarea:focus-visible,
select:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(247, 208, 70, 0.35);
}

/* Copy button micro animation */
.icon-btn {
    transition:
        background 0.2s ease,
        transform 0.15s ease,
        opacity 0.15s ease;
}

.icon-btn:hover {
    transform: scale(1.1);
}
