:root {
    /* Light Theme (Default) */
    --primary-color: #3b82f6;
    /* Modern Blue */
    --primary-hover: #2563eb;
    --bg-gradient-start: #f1f5f9;
    --bg-gradient-end: #cbd5e1;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
    --input-focus-bg: #ffffff;
    --radius: 16px;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
    --ad-bg: #f1f5f9;
    --ad-border: #cbd5e1;
}

[data-theme="dark"] {
    /* Dark Theme Overrides */
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --input-bg: #0f172a;
    --input-focus-bg: #1e293b;
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -2px rgb(0 0 0 / 0.3);
    --ad-bg: #0f172a;
    --ad-border: #334155;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

.app-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

header {
    width: 100%;
    text-align: center;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 0.5rem;
}

.header-controls {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

#theme-toggle {
    position: relative;
    right: auto;
    padding: 0.5rem;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.2s;
}

#language-selector {
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--input-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#language-selector:hover,
#language-selector:focus {
    border-color: var(--primary-color);
    outline: none;
}

#theme-toggle:hover {
    background: rgba(128, 128, 128, 0.1);
}

/* Hide/Show icons based on theme */
.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: none;
}


header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
}

.input-group label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    letter-spacing: 0.01em;
}

textarea,
input[type="text"] {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    transition: all 0.2s ease;
    background: var(--input-bg);
    color: var(--text-main);
}

textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    /* Blue glow */
    background: var(--input-focus-bg);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.actions {
    display: flex;
    justify-content: flex-end;
}

.btn {
    cursor: pointer;
    border: none;
    border-radius: 10px;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: 0.01em;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn.primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.4);
}

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

.btn.icon {
    padding: 0.75rem;
    background-color: var(--input-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.btn.icon:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: rgba(59, 130, 246, 0.05);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    min-height: 60px;
}

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem;
    text-align: center;
    background: var(--input-bg);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    gap: 1rem;
    transition: all 0.2s ease;
}

.result-item:hover {
    border-color: var(--primary-color);
    background: var(--input-focus-bg);
}

.result-url {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: monospace;
    font-size: 0.95rem;
    color: var(--text-main);
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.global-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    position: relative;
    /* For feedback anchoring */
}

.global-actions.hidden {
    display: none;
}

.feedback {
    font-size: 0.85rem;
    font-weight: 600;
    color: #10b981;
    /* Emerald 500 */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 100%;
    margin-right: 1rem;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.feedback.show {
    opacity: 1;
}

.btn.secondary {
    background-color: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn.secondary:hover {
    background-color: var(--border-color);
    color: var(--text-main);
}


/* Ad Placeholder Styles */
.ad-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.ad-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.ad-mockup {
    width: 100%;
    height: 100px;
    background-color: var(--ad-bg);
    border: 2px dashed var(--ad-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 500;
    transition: background 0.3s, border-color 0.3s;
}

footer {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
    font-weight: 500;
}

@media (max-width: 480px) {
    .card {
        padding: 1.5rem;
    }

    header h1 {
        font-size: 2rem;
    }
}