/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --bg-primary: #111827;
        --bg-secondary: #1f2937;
        --border-color: #374151;
    }

    /* Dark mode AI loading overlay */
    .ai-loading-overlay {
        background: rgba(0, 0, 0, 0.85) !important;
    }

    .loading-title {
        color: #ffffff !important;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    }

    .model-status span {
        color: rgba(255, 255, 255, 0.8) !important;
    }

    .model-status.active span {
        color: rgba(255, 255, 255, 1) !important;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    /* Better text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Disable tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.5rem 1rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s ease-out;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
}

.main-logo {
    width: 320px;
    height: auto;
    max-width: 100%;
    animation: fadeIn 0.8s ease-out;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.highlight {
    color: var(--primary-color);
    position: relative;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Input Section */
.input-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    animation: fadeIn 0.6s ease-out 0.2s both;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
}

input[type="text"] {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    /* Improve mobile text input */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Buttons */
.primary-btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    /* Better touch support */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

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

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

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Result Section */
.result-section {
    background: var(--bg-secondary);
    border: 2px solid var(--success-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    animation: slideIn 0.4s ease-out;
}

.result-section.hidden {
    display: none;
}

.success-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success-color);
    font-weight: 500;
    margin-bottom: 1rem;
}

.check-icon {
    flex-shrink: 0;
}

.url-display {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.url-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: 'Monaco', 'Courier New', monospace;
}

.copy-btn {
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

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

.copy-btn.copied {
    background: var(--success-color);
}

.preview-section {
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.preview-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.preview-btn {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.preview-btn:hover {
    color: var(--primary-hover);
}

/* Info Section */
.info-section {
    margin-bottom: 2rem;
    animation: fadeIn 0.6s ease-out 0.4s both;
}

.info-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.steps {
    list-style-position: inside;
    padding-left: 0;
}

.steps li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.6s ease-out 0.6s both;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.feature-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* Responsive Design */
@media (max-width: 640px) {
    .main-logo {
        width: 260px;
    }

    header {
        margin-bottom: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-section,
    .result-section {
        padding: 1.5rem;
        border-radius: 8px;
    }

    input[type="text"] {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 1rem;
    }

    .primary-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        /* Better touch target size */
        min-height: 48px;
        width: 100%;
    }

    .url-display {
        flex-direction: column;
        gap: 0.75rem;
    }

    .url-input {
        font-size: 14px;
    }

    .copy-btn {
        width: 100%;
        min-height: 44px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .feature-card h3 {
        font-size: 1.125rem;
    }

    .feature-card p {
        font-size: 0.875rem;
    }

    /* Better mobile spacing */
    header {
        margin-bottom: 2rem;
    }

    .container {
        padding: 1.5rem 1rem;
    }
}

/* Demo Page Styles */
.demo-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    text-align: center;
}

.demo-header {
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease-out;
    text-align: center;
}

.demo-logo {
    width: 280px;
    height: auto;
    max-width: 100%;
}

.demo-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.demo-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.question-display {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 2rem;
    min-height: 3rem;
    color: var(--text-primary);
}

.cursor {
    display: inline-block;
    width: 2px;
    height: 1.5rem;
    background: var(--primary-color);
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.status-display {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.models-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.model-badge {
    padding: 0.5rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.3s, border-color 0.3s;
}

.model-badge.active {
    opacity: 1;
    border-color: var(--primary-color);
}

.spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.model-badge.active .spinner {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skip-link {
    display: inline-block;
    margin-top: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.skip-link:hover {
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease-out;
}

/* Animated Cursor */
.animated-cursor {
    position: fixed;
    width: 24px;
    height: 24px;
    pointer-events: none;
    z-index: 10000;
    display: none;
    transform: translate(-2px, -2px); /* Offset to point tip */
}

.animated-cursor.active {
    display: block;
}

.animated-cursor svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

@keyframes cursorClick {
    0%, 100% { transform: translate(-2px, -2px) scale(1); }
    50% { transform: translate(-2px, -2px) scale(0.85); }
}

.animated-cursor.clicking {
    animation: cursorClick 0.3s ease-in-out;
}

/* Apple-Style AI Loading Animation */
.ai-loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
    opacity: 0 !important;
    transition: opacity 0.4s ease !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ai-loading-overlay.active {
    display: flex !important;
    opacity: 1 !important;
}

.ai-loading-content {
    text-align: center;
    animation: loadingFadeIn 0.6s ease-out;
    position: relative;
    z-index: 100000;
    padding: 2rem;
}

/* AI Orb - Futuristic Pulsing Sphere */
.ai-orb {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 2rem;
}

.orb-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    box-shadow:
        0 0 40px rgba(102, 126, 234, 0.6),
        0 0 80px rgba(118, 75, 162, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    animation: orbPulse 2s ease-in-out infinite;
}

.orb-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(102, 126, 234, 0.4);
    animation: orbRing 3s linear infinite;
}

.orb-ring-2 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(118, 75, 162, 0.3);
    animation: orbRing 4s linear infinite reverse;
}

@keyframes orbPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        box-shadow:
            0 0 40px rgba(102, 126, 234, 0.6),
            0 0 80px rgba(118, 75, 162, 0.4),
            inset 0 0 20px rgba(255, 255, 255, 0.3);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow:
            0 0 60px rgba(102, 126, 234, 0.8),
            0 0 120px rgba(118, 75, 162, 0.6),
            inset 0 0 30px rgba(255, 255, 255, 0.4);
    }
}

@keyframes orbRing {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1.1);
        opacity: 1;
    }
}

.loading-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    animation: loadingTextPulse 2s ease-in-out infinite;
}

@keyframes loadingTextPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* AI Models Status Indicators */
.ai-models-status {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
}

.model-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.model-status.active {
    opacity: 1;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(156, 163, 175, 0.5);
    transition: all 0.3s ease;
}

.model-status.active .status-dot {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow:
        0 0 20px rgba(16, 185, 129, 0.6),
        0 0 40px rgba(16, 185, 129, 0.3);
    animation: dotPulse 1.5s ease-in-out infinite;
}

.model-status span {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
}

.model-status.active span {
    color: rgba(255, 255, 255, 1);
}

@keyframes dotPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

@keyframes loadingFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tablet adjustments */
@media (max-width: 768px) {
    .ai-loading-content {
        padding: 1.5rem;
    }

    .ai-orb {
        width: 120px;
        height: 120px;
        margin-bottom: 1.5rem;
    }

    .orb-inner {
        width: 70px;
        height: 70px;
    }

    .orb-ring {
        width: 90px;
        height: 90px;
    }

    .orb-ring-2 {
        width: 110px;
        height: 110px;
    }

    .loading-title {
        font-size: 1.625rem;
        margin-bottom: 1.5rem;
    }

    .ai-models-status {
        gap: 1.75rem;
    }

    .model-status span {
        font-size: 0.8125rem;
    }
}

/* Mobile adjustments for loading animation */
@media (max-width: 640px) {
    .ai-loading-content {
        padding: 1rem;
        width: 100%;
        max-width: 90vw;
    }

    .ai-orb {
        width: 100px;
        height: 100px;
        margin-bottom: 1.25rem;
    }

    .orb-inner {
        width: 60px;
        height: 60px;
    }

    .orb-ring {
        width: 80px;
        height: 80px;
    }

    .orb-ring-2 {
        width: 95px;
        height: 95px;
    }

    .loading-title {
        font-size: 1.375rem;
        margin-bottom: 1.25rem;
        letter-spacing: -0.01em;
    }

    .ai-models-status {
        gap: 1.25rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .model-status {
        gap: 0.375rem;
    }

    .model-status span {
        font-size: 0.75rem;
    }

    .status-dot {
        width: 10px;
        height: 10px;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .ai-orb {
        width: 80px;
        height: 80px;
    }

    .orb-inner {
        width: 50px;
        height: 50px;
    }

    .orb-ring {
        width: 65px;
        height: 65px;
    }

    .orb-ring-2 {
        width: 75px;
        height: 75px;
    }

    .loading-title {
        font-size: 1.25rem;
    }

    .ai-models-status {
        gap: 1rem;
    }
}
