@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #a855f7;
    --success: #10b981;
    --border: rgba(255, 255, 255, 0.1);
    --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
    --input-bg: rgba(15, 23, 42, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
}

/* ── Background Blobs ── */
.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: var(--primary-gradient);
    filter: blur(140px);
    opacity: 0.1;
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.blob-2 {
    bottom: -100px;
    left: -100px;
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
}

/* ── Main Layout ── */
.tool-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 32px;
    padding: 2.5rem;
    box-shadow: var(--shadow-premium);
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.5rem;
}

.header p {
    color: var(--text-secondary);
}

/* ── Inputs ── */
.section-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.input-group:last-child {
    margin-bottom: 0;
}

label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

textarea {
    width: 100%;
    height: 150px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: #fff;
    padding: 1rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: all 0.3s;
}

textarea:focus,
input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.1);
}

.password-wrapper {
    position: relative;
    display: flex;
}

input[type="password"],
input[type="text"] {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: #fff;
    padding: 1rem 3.5rem 1rem 1rem;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.visibility-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* ── Actions ── */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.main-actions {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.btn {
    padding: 0.9rem 1.75rem;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    flex: 1;
}

.btn-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.2);
    flex: 1;
}

.btn-success:hover {
    background: var(--success);
    color: #fff;
    transform: translateY(-2px);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ── Results ── */
.result-section {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    border-color: var(--accent);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 800;
}

.copy-btn.mini {
    background: rgba(168, 85, 247, 0.1);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.copy-btn:hover {
    background: var(--accent);
    color: #fff;
}

.output-area {
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.security-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    font-style: italic;
    text-align: center;
}

/* ── Loader ── */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 32px;
    gap: 1.5rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(168, 85, 247, 0.1);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .tool-container {
        padding: 1.5rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .main-actions {
        flex-direction: column;
    }

    .btn-secondary {
        order: 2;
    }

    .main-actions {
        order: 1;
    }
}