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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #0ea5e9;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: 0.3s ease;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 3rem;
}

.logo-container {
    margin-bottom: 1rem;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

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

/* Main Content */
main {
    flex: 1;
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    max-width: 700px;
    margin: 0 auto;
}

#urlInput {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

#urlInput::placeholder {
    color: var(--text-muted);
}

#analyzeBtn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

#analyzeBtn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

#analyzeBtn:active {
    transform: translateY(0);
}

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

.hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.75rem;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error Section */
.error-section {
    max-width: 700px;
    margin: 0 auto 2rem;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--border-radius);
    color: #fca5a5;
}

.error-icon {
    font-size: 1.5rem;
    color: var(--error);
}

/* Results Section */
.results-section {
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease;
}

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

.results-section h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.results-url {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
}

.results-url a {
    color: var(--secondary-color);
    text-decoration: none;
    word-break: break-all;
}

.results-url a:hover {
    text-decoration: underline;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.result-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.result-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--surface-light);
}

.card-icon {
    font-size: 1.5rem;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-content {
    min-height: 60px;
}

.no-results {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* Technology Tags */
.tech-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    background: var(--surface-light);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: background-color var(--transition);
}

.tech-tag:hover {
    background: var(--primary-color);
}

.tech-tag .version {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.tech-tag.confidence-high {
    border-left: 3px solid var(--success);
}

.tech-tag.confidence-medium {
    border-left: 3px solid var(--warning);
}

.tech-tag.confidence-low {
    border-left: 3px solid var(--text-muted);
}

/* Headers Section */
.headers-section {
    margin-top: 2rem;
}

.toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color var(--transition);
}

.toggle-btn:hover {
    background: var(--surface-light);
}

.toggle-icon {
    transition: transform var(--transition);
}

.toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.headers-content {
    margin-top: 1rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.headers-content pre {
    color: var(--text-secondary);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Info Section */
.info-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--surface-light);
}

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

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-card {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--surface);
    border-radius: var(--border-radius);
    transition: transform var(--transition);
}

.info-card:hover {
    transform: translateY(-4px);
}

.info-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.info-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

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

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--surface-light);
}

footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .input-group {
        flex-direction: column;
    }

    #analyzeBtn {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .logo {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .result-card {
        padding: 1rem;
    }

    .info-card {
        padding: 1.5rem 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: var(--primary-color);
    color: white;
}
