@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --border-color: #e2e8f0;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0c1015;
        --surface-color: #1a1f26;
        --text-main: #f1f5f9;
        --text-muted: #94a3b8;
        --primary: #6366f1;
        --primary-hover: #818cf8;
        --border-color: #2a313c;
        --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    }
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Space Grotesk', sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
    background-attachment: fixed;
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

.container {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

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

.header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.2rem;
    margin: 0;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 8px;
    margin-bottom: 0;
}

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

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Space Grotesk', sans-serif;
    transition: all 0.2s ease;
}

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

button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* History Section */
.history-container {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
}

.history-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.history-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-pill {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-pill:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.history-pill .icon {
    color: var(--primary);
    font-size: 0.9rem;
}

/* Status Cards */
.result-card {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    display: none;
    animation: slideUp 0.3s ease forwards;
}

.result-card.success {
    display: block;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.result-card.error {
    display: block;
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.result-card.success p,
.result-card.error p {
    color: var(--text-main);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.success .status-badge {
    background: #10b981;
    color: white;
}

.error .status-badge {
    background: #ef4444;
    color: white;
}

/* Rich Metadata UI Elements */
.rich-embed-card {
    margin-top: 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
}

.rich-embed-cover {
    width: 100%;
    height: 140px;
    object-fit: cover;
}

.rich-embed-body {
    padding: 15px;
    position: relative;
}

.rich-embed-pfp {
    position: absolute;
    right: 15px;
    top: -30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid var(--surface-color);
    background: var(--bg-color);
}

.rich-embed-title {
    margin: 0;
    font-size: 1.15rem;
    color: var(--text-main);
    font-family: 'Orbitron', sans-serif;
}

.rich-embed-title a {
    color: inherit;
    text-decoration: none;
}

.rich-embed-desc {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.rich-embed-rating {
    margin-top: 15px;
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

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

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: none;
    width: auto;
    padding: 8px;
    border-radius: 50%;
    margin: 0;
}

.theme-toggle:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: none;
    box-shadow: none;
}

.theme-toggle svg {
    display: block;
}

/* Tags Input Container */
.tags-input-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 12px;
    min-height: 52px;
    transition: all 0.2s ease;
}

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

.tags-input-container input {
    flex: 1;
    min-width: 120px;
    border: none;
    background: transparent;
    padding: 4px;
    margin: 0;
    box-shadow: none !important;
    outline: none !important;
}

.tag-pill {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: scaleIn 0.2s ease;
}

.tag-pill .remove-tag {
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    line-height: 1;
    color: var(--primary);
}

.tag-pill .remove-tag:hover {
    color: #ef4444;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Custom Toasts */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--surface-color);
    color: var(--text-main);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    border-radius: 12px;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
    overflow: hidden;
}

.toast.toast-success {
    border-left-color: #10b981;
}

.toast.toast-error {
    border-left-color: #ef4444;
}

.toast-body {
    margin-right: 15px;
    width: 100%;
}

.toast-title {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-family: 'Orbitron', sans-serif;
}

.toast.toast-success .toast-title {
    color: #10b981;
}

.toast.toast-error .toast-title {
    color: #ef4444;
}

.toast-msg {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    word-break: break-all;
}

.toast-close {
    background: transparent;
    margin: 0;
    padding: 0;
    width: auto;
    box-shadow: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    border: none;
}

.toast-close:hover {
    color: var(--text-main);
    transform: none;
    background: transparent;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Light/Dark Mode override classes */
body.light-mode {
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

body.dark-mode {
    --bg-color: #0c1015;
    --surface-color: #1a1f26;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #2a313c;
}

/* Ad Placement Styles */
.ad-container {
    width: 100%;
    max-width: 100%;
    margin: 10px auto;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.ad-placeholder {
    width: 100%;
    height: auto;
    min-height: 60px;
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Mobile specific fixes */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .ad-container iframe {
        max-width: 100% !important;
        transform: scale(0.8);
        transform-origin: center;
    }
}