/* ───────────────────────────────────────────────────────────────────────
   URL Shortener — styly
   ─────────────────────────────────────────────────────────────────────── */

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

:root {
    --color-bg: #070b14;
    --color-bg-card: #0d1526;
    --color-bg-input: #111a2e;
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-focus: rgba(99, 102, 241, 0.6);
    --color-primary: #6366f1;
    --color-primary-hover: #818cf8;
    --color-primary-bg: rgba(99, 102, 241, 0.15);
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.15);
    --color-error: #f87171;
    --color-error-bg: rgba(248, 113, 113, 0.1);
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-text-faint: #475569;

    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    --font-mono: 'SFMono-Regular', Menlo, Monaco, 'Cascadia Code', monospace;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --max-width: 680px;

    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-btn: 0 4px 15px rgba(99, 102, 241, 0.35);
    --shadow-btn-hover: 0 6px 22px rgba(99, 102, 241, 0.45);
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    background-image:
        radial-gradient(ellipse 60% 50% at 20% 0%, rgba(99, 102, 241, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 90% 20%, rgba(139, 92, 246, 0.10) 0%, transparent 60%);
    background-repeat: no-repeat;
}

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    padding: 1.75rem 0;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo svg {
    width: 26px;
    height: 26px;
    color: var(--color-primary);
    flex-shrink: 0;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem 0 4rem;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 2.25rem;
}

.hero h1 {
    font-size: clamp(1.9rem, 5vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.hero p {
    font-size: 1.0625rem;
    color: var(--color-text-muted);
}

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

/* Honeypot - skryté pole proti botům */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Form */
.input-group {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.url-input {
    flex: 1;
    background: var(--color-bg-input);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    padding: 0.875rem 1.125rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

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

.url-input:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.url-input.error {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

.submit-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: var(--shadow-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 150px;
}

.submit-btn:hover:not(:disabled) {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-btn-hover);
    transform: translateY(-1px);
}

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

.submit-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error message */
.error-msg {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--color-error-bg);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: var(--radius-sm);
    color: var(--color-error);
    font-size: 0.875rem;
    animation: fadeIn 0.2s ease;
}

.hint {
    margin-top: 0.875rem;
    font-size: 0.8125rem;
    color: var(--color-text-faint);
}

/* Quantity selector */
.quantity-group {
    margin-top: 1.25rem;
}

.quantity-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.625rem;
}

.quantity-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.qty-btn {
    background: var(--color-bg-input);
    border: 1.5px solid var(--color-border);
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--color-text);
}

.qty-btn.active {
    background: var(--color-primary-bg);
    border-color: rgba(99, 102, 241, 0.5);
    color: var(--color-primary-hover);
}

.custom-qty-input {
    margin-top: 0.625rem;
    width: 100%;
    background: var(--color-bg-input);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.9375rem;
    font-family: inherit;
    padding: 0.625rem 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-qty-input:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Result section */
.result-section {
    animation: fadeIn 0.3s ease;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.result-badge svg {
    width: 20px;
    height: 20px;
}

/* List of generated short links (supports bulk results) */
.result-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1rem;
    max-height: 320px;
    overflow-y: auto;
}

.result-url-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--color-bg-input);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
}

.copy-all-btn {
    display: block;
    width: 100%;
    background: var(--color-primary-bg);
    border: 1.5px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius);
    color: var(--color-primary-hover);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
}

.copy-all-btn:hover {
    background: var(--color-primary);
    color: #fff;
}

.result-link {
    flex: 1;
    color: var(--color-primary-hover);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    word-break: break-all;
    min-width: 0;
}

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

.copy-btn {
    background: var(--color-primary-bg);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--color-primary-hover);
    border-radius: var(--radius-sm);
    padding: 0.55rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copy-btn svg { width: 18px; height: 18px; }

.copy-btn:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.copy-btn.copied {
    background: var(--color-success-bg);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--color-success);
}

.new-url-btn {
    display: block;
    width: 100%;
    background: transparent;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    padding: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.new-url-btn:hover {
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.03);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: toastIn 0.25s ease;
    white-space: nowrap;
}

.toast--success {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.toast--error {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.15);
    color: var(--color-error);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

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

/* Footer */
.footer {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--color-text-faint);
    font-size: 0.8125rem;
    border-top: 1px solid var(--color-border);
}

/* 404 page */
.error-page {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
}

.error-code {
    font-size: 5.5rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: var(--color-text-faint);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-page h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.75rem;
}

.error-page p {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    max-width: 380px;
}

.home-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.875rem 2rem;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s, transform 0.1s;
    box-shadow: var(--shadow-btn);
}

.home-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 540px) {
    .input-group {
        flex-direction: column;
    }

    .submit-btn {
        width: 100%;
    }

    .card {
        padding: 1.5rem;
    }

    .error-code {
        font-size: 4rem;
    }

    .toast {
        white-space: normal;
        width: calc(100% - 2rem);
        text-align: center;
    }
}
