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

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --gradient-start: #6366f1;
    --gradient-end: #8b5cf6;
    --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);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

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

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

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

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

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

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

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

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

#url-form {
    max-width: 700px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    background: var(--surface);
    padding: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

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

#url-input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
}

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

#analyze-btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

#analyze-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

#analyze-btn:active {
    transform: translateY(0);
}

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

.btn-loader {
    width: 18px;
    height: 18px;
    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);
    }
}

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

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

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

.results-header {
    text-align: center;
    margin-bottom: 2rem;
}

.results-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.analyzed-url {
    color: var(--text-secondary);
    font-size: 0.875rem;
    word-break: break-all;
}

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

.result-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
}

.result-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 1px solid var(--border-color);
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-content {
    padding: 1.25rem;
    min-height: 100px;
}

.no-results {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Technology Tags */
.tech-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    margin: 0.25rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 9999px;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.tech-tag:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}

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

.tech-tag .confidence {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 0.25rem;
}

.confidence.high {
    background: var(--success);
}

.confidence.medium {
    background: var(--warning);
}

.confidence.low {
    background: var(--error);
}

/* Report Section */
.report-section {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.report-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.report-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary-color);
}

.report-btn.secondary {
    background: transparent;
}

.report-output {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.report-output h3 {
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.report-output pre {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Error Section */
.error-section {
    max-width: 500px;
    margin: 2rem auto;
    animation: fadeIn 0.3s ease;
}

.error-content {
    background: var(--surface);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.error-content h3 {
    color: var(--error);
    margin-bottom: 0.5rem;
}

.error-content p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.retry-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.retry-btn:hover {
    opacity: 0.9;
}

/* Info Section */
.info-section {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.info-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

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

.info-item {
    text-align: center;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.info-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.info-item h4 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

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

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

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

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

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

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

    h1 {
        font-size: 1.75rem;
    }

    .logo-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .input-group {
        flex-direction: column;
        padding: 0.75rem;
    }

    #url-input {
        padding: 1rem;
        text-align: center;
    }

    #analyze-btn {
        width: 100%;
        justify-content: center;
        padding: 1rem;
    }

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

    .report-section {
        flex-direction: column;
    }

    .report-btn {
        width: 100%;
    }

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

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .results-header h2 {
        font-size: 1.5rem;
    }

    .card-content {
        padding: 1rem;
    }

    .tech-tag {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .container {
        max-width: 100%;
    }

    .input-section,
    .info-section,
    .report-section {
        display: none;
    }

    .result-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}
