/* =============================================
   ls0.ru — Brutalist Geometric Dark/Light Theme
   Fonts: Space Grotesk + JetBrains Mono
   Accent: Crimson Red #ff2d55
   ============================================= */

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

/* ---- Dark theme (default) ---- */
:root {
    --bg: #0a0a0a;
    --surface: #111111;
    --surface-2: #181818;
    --border: #1e1e1e;
    --border-hover: #2a2a2a;
    --text: #e0e0e0;
    --text-dim: #555;
    --text-muted: #333;
    --accent: #ff2d55;
    --accent-dim: rgba(255, 45, 85, .15);
    --accent-glow: rgba(255, 45, 85, .08);
    --accent-text: #fff;
    --error: #ff3b3b;
    --grid-opacity: .03;
    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ---- Light theme ---- */
[data-theme="light"] {
    --bg: #f5f5f0;
    --surface: #ffffff;
    --surface-2: #f0f0eb;
    --border: #ddd;
    --border-hover: #ccc;
    --text: #1a1a1a;
    --text-dim: #888;
    --text-muted: #bbb;
    --accent: #e0153a;
    --accent-dim: rgba(224, 21, 58, .1);
    --accent-glow: rgba(224, 21, 58, .05);
    --accent-text: #fff;
    --error: #d32f2f;
    --grid-opacity: .04;
}

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

body {
    font-family: var(--font-display);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    transition: background .3s, color .3s;
}

/* ---- Background ---- */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,45,85,var(--grid-opacity)) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,45,85,var(--grid-opacity)) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255,45,85,.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ---- Header ---- */
.site-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}

.logo-mark {
    color: var(--accent);
    font-size: 28px;
    line-height: 1;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo-dot {
    color: var(--accent);
}

/* ---- Theme Toggle ---- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 6px 12px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 12px;
    transition: all .2s;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* ---- Hero ---- */
.hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 80px 20px 40px;
}

.hero-title {
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -2px;
}

.hero-line {
    display: block;
}

.hero-accent {
    color: var(--accent);
}

.hero-sub {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-dim);
    margin-top: 20px;
    letter-spacing: 0.5px;
}

/* ---- Shortener ---- */
main {
    position: relative;
    z-index: 1;
    flex: 1;
}

.shortener-section {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}

.shortener-form {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 32px;
    transition: background .3s, border-color .3s;
}

.input-row {
    margin-bottom: 24px;
}

.url-input-wrap {
    position: relative;
}

.url-input-wrap input {
    width: 100%;
    padding: 18px 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 15px;
    outline: none;
    transition: border-color .2s, background .3s;
}

.url-input-wrap input::placeholder {
    color: var(--text-muted);
}

.url-input-wrap input:focus {
    border-color: var(--accent);
}

.input-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width .3s ease;
}

.url-input-wrap input:focus ~ .input-accent {
    width: 100%;
}

/* ---- Options ---- */
.options-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.option-group {
    width: 100%;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.lock-ico {
    color: var(--text-dim);
}

/* Segmented control */
.segmented-control {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid var(--border);
}

.segmented-control button {
    flex: 1 0 auto;
    padding: 10px 10px;
    background: var(--bg);
    border: none;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}

.segmented-control button:last-child {
    border-right: none;
}

.segmented-control button:hover {
    color: var(--text);
    background: var(--surface-2);
}

.segmented-control button.active {
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 500;
}

/* Password field */
.password-group input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color .2s;
}

.password-group input::placeholder {
    color: var(--text-muted);
}

.password-group input:focus {
    border-color: var(--accent);
}

/* ---- Submit Button ---- */
.submit-btn {
    width: 100%;
    padding: 18px;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0,0,0,.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width .4s, height .4s;
}

.submit-btn:active::before {
    width: 400px;
    height: 400px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(255,45,85,.25);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loader dots */
.btn-loader {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.loader-dot {
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    animation: dotPulse .6s ease-in-out infinite;
}

.loader-dot:nth-child(2) { animation-delay: .15s; }
.loader-dot:nth-child(3) { animation-delay: .3s; }

@keyframes dotPulse {
    0%, 100% { opacity: .3; transform: scale(.8); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ---- Result Card ---- */
.result-card {
    margin-top: 24px;
    background: var(--surface);
    border: 1px solid var(--accent);
    padding: 32px;
    animation: slideUp .4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.result-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}

.result-badges {
    display: flex;
    gap: 8px;
}

.badge {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-locked {
    border-color: var(--accent);
    color: var(--accent);
}

/* Result URL */
.result-url-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.result-url {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}

.result-url:hover {
    text-decoration: underline;
}

.copy-btn {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    transition: all .2s;
}

.copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.copy-btn.copied {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* QR Code */
.result-qr {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #fff;
    margin-bottom: 20px;
}

.result-qr canvas, .result-qr img {
    display: block !important;
}

/* Stats link */
.stats-link {
    display: block;
    text-align: center;
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    text-decoration: none;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    transition: all .2s;
}

.stats-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* New link button */
.new-link-btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}

.new-link-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- Error Toast ---- */
.error-toast {
    margin-top: 16px;
    padding: 14px 20px;
    background: rgba(255, 59, 59, .1);
    border: 1px solid rgba(255, 59, 59, .3);
    color: var(--error);
    font-family: var(--font-mono);
    font-size: 13px;
    animation: slideUp .3s ease-out;
}

/* ---- Recent Links ---- */
.recent-section {
    max-width: 640px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.section-title {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.recent-list {
    border: 1px solid var(--border);
    background: var(--surface);
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-item:hover {
    background: var(--surface-2);
}

.recent-code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text);
}

.recent-date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Notes ---- */
.note-textarea {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg);
    border: 2px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    min-height: 160px;
    transition: border-color .2s, background .3s;
}

.note-textarea::placeholder {
    color: var(--text-muted);
}

.note-textarea:focus {
    border-color: var(--accent);
}

.note-view-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 32px;
    animation: slideUp .4s ease-out;
}

.note-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.note-view-content {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    padding: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 600px;
    overflow-y: auto;
}

.note-view-footer {
    margin-top: 20px;
}

.copy-btn-wide {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
}

.copy-btn-wide:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Note HTML content (from TinyMCE) */
.note-html-content {
    white-space: normal;
}

.note-html-content p { margin-bottom: 10px; }
.note-html-content p:last-child { margin-bottom: 0; }
.note-html-content ul, .note-html-content ol { margin: 10px 0 10px 20px; }
.note-html-content li { margin-bottom: 4px; }
.note-html-content a { color: var(--accent); }
.note-html-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 16px;
    margin: 10px 0;
    color: var(--text-dim);
}
.note-html-content code {
    background: var(--surface-2);
    padding: 2px 6px;
    font-size: 13px;
}
.note-html-content pre {
    background: var(--surface-2);
    padding: 12px;
    overflow-x: auto;
    margin: 10px 0;
}
.note-html-content strong, .note-html-content b { font-weight: 600; }

.nav-back-link {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    text-decoration: none;
    transition: color .2s;
}

.nav-back-link:hover {
    color: var(--accent);
}

/* ---- Footer ---- */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 30px 20px;
    border-top: 1px solid var(--border);
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .site-header {
        padding: 16px 20px;
    }

    .hero {
        padding: 50px 20px 30px;
    }

    .hero-title {
        letter-spacing: -1px;
    }

    .shortener-form {
        padding: 20px;
    }

    .options-row {
        flex-direction: column;
        gap: 16px;
    }

    .segmented-control button {
        padding: 10px 4px;
        font-size: 11px;
    }

    .result-card {
        padding: 20px;
    }

    .result-url {
        font-size: 15px;
    }

    .recent-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
