:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #f43f5e;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card-bg: #1e293b;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #334155;
    }
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Left Panel: Input Area */
.input-panel {
    flex: 0 0 600px;
    padding: 40px;
    border-right: 1px solid var(--border);
    background: var(--card-bg);
    overflow-y: auto;
}

/* Right Panel: Preview Area */
.preview-panel {
    flex: 1;
    padding: 40px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow-y: auto;
}

.header {
    margin-bottom: 32px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

h1 {
    font-size: 24px;
    font-weight: 700;
}

.tagline {
    color: var(--text-muted);
    font-size: 14px;
}

.beta-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 600;
    border-radius: 99px;
    margin-left: 8px;
    vertical-align: middle;
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

textarea {
    width: 100%;
    height: 150px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    transition: border-color 0.2s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.setting-item select,
.setting-item input {
    width: 100%;
    height: 44px;
    /* Fixed height for consistency */
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-main);
    font-size: 14px;
    transition: opacity 0.2s, background 0.2s, border-color 0.2s;
    display: block;
    appearance: none;
    /* Remove browser defaults */
}

.setting-item select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.setting-item select:disabled,
.setting-item input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg);
    /* Keep it similar but slightly faded */
    border-color: var(--border);
    color: var(--text-muted);
}

.generate-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 12px;
}

.generate-btn:hover {
    background: var(--primary-hover);
}

.generate-btn:active {
    transform: scale(0.98);
}

/* Locked Page Styles */
.locked-container {
    text-align: center;
    padding: 40px 20px;
}

.lock-icon {
    font-size: 48px;
    margin-bottom: 24px;
    color: var(--primary);
}

.password-form {
    max-width: 320px;
    margin: 24px auto;
}

.password-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text-main);
    margin-bottom: 16px;
    font-size: 16px;
    text-align: center;
}

/* Preview Styles */
.preview-card {
    width: 100%;
    max-width: 500px;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 32px;
    border: 1px solid var(--border);
}

.preview-header {
    text-align: center;
    margin-bottom: 24px;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-item {
    display: flex;
    align-items: center;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-main);
    transition: transform 0.2s, background 0.2s;
}

.link-item:hover {
    transform: translateY(-2px);
    background: var(--border);
}

.link-icon {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
    box-shadow: var(--shadow);
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.link-content {
    flex: 1;
    min-width: 0;
}

.link-content h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    word-break: break-word;
}

.link-content span {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    display: block;
}

/* Modal / Overlay for Result */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--card-bg);
    padding: 32px;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.qr-container {
    margin: 24px 0;
    display: flex;
    justify-content: center;
}

.copy-area {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.copy-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg);
    color: var(--primary);
    font-weight: 600;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
    }

    .input-panel {
        flex: none;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}