/* CSS Variables for theming */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --accent: #00d4aa;
    --accent-hover: #00ffcc;
    --accent-dim: #00d4aa33;
    --error: #ff4757;
    --error-dim: #ff475733;
    --success: #2ed573;
    --border-color: #2a2a3a;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    --radius: 12px;
    --transition: 0.3s ease;
}

/* Reset and base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #121212;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* Main container */
.container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
    text-align: center;
}

/* Vault icon */
.vault-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    color: var(--accent);
    opacity: 0.9;
}

.vault-icon svg {
    width: 100%;
    height: 100%;
}

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 30px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

/* Form styles */
.input-group {
    display: flex;
    gap: 10px;
}

#password-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

#password-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

#password-input::placeholder {
    color: var(--text-secondary);
}

#password-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Shake animation for errors */
#password-input.shake {
    animation: shake 0.5s ease-in-out;
    border-color: var(--error);
    box-shadow: 0 0 0 3px var(--error-dim);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Submit button */
#submit-btn {
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    position: relative;
    min-width: 100px;
}

#submit-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

#submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#submit-btn .btn-text {
    transition: opacity var(--transition);
}

#submit-btn.loading .btn-text {
    opacity: 0;
}

#submit-btn.loading .spinner {
    opacity: 1;
}

/* Spinner */
.spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--bg-primary);
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--error);
    color: white;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 500;
    opacity: 0;
    transition: transform var(--transition), opacity var(--transition);
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(255, 71, 87, 0.3);
}

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

/* Result container */
.result-container {
    display: none;
    margin-top: 30px;
    padding: 25px;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    text-align: left;
    animation: fadeIn 0.3s ease;
}

.result-container.show {
    display: block;
}

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

/* Result content - styles for injected HTML */
.result-content {
    line-height: 1.6;
}

.result-content h1 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--accent);
    text-align: left;
}

.result-content h2 {
    font-size: 1.25rem;
    margin: 20px 0 10px;
    color: var(--text-primary);
}

.result-content h3 {
    font-size: 1.1rem;
    margin: 15px 0 8px;
    color: var(--text-primary);
}

.result-content p {
    margin: 10px 0;
    color: var(--text-primary);
}

.result-content pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    margin: 15px 0;
}

.result-content code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--accent);
}

.result-content pre code {
    color: var(--text-primary);
}

.result-content a {
    color: var(--accent);
    text-decoration: none;
}

.result-content a:hover {
    text-decoration: underline;
}

.result-content ul, .result-content ol {
    margin: 10px 0;
    padding-left: 25px;
}

.result-content li {
    margin: 5px 0;
}

.result-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

.result-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 15px;
    margin: 15px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.result-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.result-content th, .result-content td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
}

.result-content th {
    background: var(--bg-secondary);
}

/* Close button */
.close-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

.close-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 30px 20px;
    }

    .input-group {
        flex-direction: column;
    }

    #submit-btn {
        width: 100%;
    }
}
