/* --- Global Styles & Variables --- */
:root {
    --bg-color: #111827; /* Mild Dark Blue/Gray */
    --text-primary: #f9fafb; /* Almost White */
    --text-secondary: #9ca3af; /* Gray 400 */
    --accent-primary: #60a5fa; /* Blue 400 */
    --accent-secondary: #818cf8; /* Indigo 400 */
    --accent-glow: rgba(96, 165, 250, 0.3);
    --glass-bg: rgba(30, 41, 59, 0.6); /* Slate 800 with opacity */
    --glass-border: rgba(96, 165, 250, 0.2);
    --surface-color: #1f2937; /* Gray 800 */
    --border-color: #374151; /* Gray 700 */
    --success-color: #4ade80; /* Green 400 */
    --danger-color: #f87171; /* Red 400 */
    --warning-color: #facc15; /* Yellow 400 */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    overflow: hidden;
}

/* --- New Animated Gradient Background --- */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(ellipse at top, var(--accent-secondary), transparent),
                radial-gradient(ellipse at bottom, var(--accent-primary), transparent);
    background-size: 300% 300%;
    opacity: 0.15;
    animation: gradient-move 25s ease infinite;
}

@keyframes gradient-move {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- App Layout --- */
.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    height: 100vh;
}

@media (min-width: 1024px) {
    .app-grid {
        grid-template-columns: 480px 1fr;
    }
}

.input-section {
    background: var(--bg-color);
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
}

.output-section {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* --- Header --- */
.app-header .brand-logo {
    font-size: 1.75rem;
    font-weight: 700;
    text-decoration: none;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    margin-bottom: 2.5rem;
}

.app-header .app-title {
    font-size: 2.75rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
}

.app-header .app-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    line-height: 1.6;
    max-width: 400px;
}

/* --- Input Area --- */
.input-container {
    margin: 2rem 0;
}

.input-label {
    display: block;
    text-align: left;
    font-weight: 500;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0 1.25rem;
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-icon {
    color: var(--text-secondary);
}

.url-input {
    flex-grow: 1;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 1rem 0;
    outline: none;
}

.btn-primary {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    color: var(--text-primary);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 7px 25px var(--accent-glow);
}

/* --- Result Area --- */
.result-area {
    width: 100%;
    max-width: 700px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 2.5rem;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    min-height: 350px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.4s ease;
}

.initial-state {
    text-align: center;
    color: var(--text-secondary);
    animation: fade-in 0.5s ease;
}

.initial-icon-wrapper {
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1.5rem auto;
    border-radius: 50%;
    background: rgba(96, 165, 250, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.initial-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--accent-primary);
}

.initial-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-card-wrapper {
    animation: fade-in 0.5s ease;
}

.result-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.result-icon {
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
}
.result-card.success .result-icon { color: var(--success-color); }
.result-card.danger .result-icon { color: var(--danger-color); }
.result-card.error .result-icon { color: var(--warning-color); }

.result-text-content .status {
    font-size: 1.75rem;
    font-weight: 700;
}
.result-card.success .status { color: var(--success-color); }
.result-card.danger .status { color: var(--danger-color); }
.result-card.error .status { color: var(--warning-color); }

.result-text-content .message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.ai-explanation {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    background: linear-gradient(to right, rgba(96, 165, 250, 0.1), rgba(129, 140, 248, 0.1));
    color: var(--accent-primary);
}

.explanation-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* --- Retrain Button --- */
.retrain-section {
    margin-top: 2rem;
    width: 100%;
    max-width: 700px;
}
.btn-secondary {
    width: 100%;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
}
.btn-secondary:hover:not(:disabled) {
    background-color: var(--surface-color);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* --- Footer --- */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.heart-emoji {
    color: var(--danger-color);
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-link {
    color: var(--text-secondary);
    transition: color 0.2s;
}
.footer-link:hover {
    color: var(--accent-primary);
}

/* --- Utilities & Animations --- */
.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.loader {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    animation: spin 1s linear infinite;
}

/* Toast Notification */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: var(--surface-color);
    color: var(--text-primary);
    text-align: center;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    position: fixed;
    z-index: 10;
    left: 50%;
    transform: translateX(-50%);
    bottom: 30px;
    opacity: 0;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

/* Responsive adjustments */
@media (max-width: 1023px) {
    body { overflow-y: auto; }
    .app-grid {
        height: auto;
        padding: 2rem 1.5rem;
    }
    .input-section, .output-section {
        padding: 0;
    }
    .output-section {
        margin-top: 3rem;
    }
    .app-header {
        position: static;
        margin-bottom: 2rem;
    }
    .app-footer {
        position: static;
        margin-top: 3rem;
    }
}
