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

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --highlight: #60a5fa;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --beginner: #10b981;
    --intermediate: #f59e0b;
    --advanced: #ef4444;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* Header */
.site-header {
    background-color: var(--bg-card);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
}

.site-header h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    font-weight: 700;
}

.btn-home-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-home-header:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 3rem 0;
}

.generator-section {
    margin-bottom: 3rem;
}

/* Form Card */
.form-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}

.form-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.cluster-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input,
.form-group select {
    padding: 0.875rem;
    background-color: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

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

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 3rem;
    background-color: var(--bg-card);
    border-radius: 12px;
    margin: 2rem 0;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.hidden {
    display: none !important;
}

/* Results Section */
.results-section {
    margin-top: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
}

.view-controls {
    display: flex;
    gap: 0.5rem;
    background-color: var(--bg-card);
    padding: 0.5rem;
    border-radius: 8px;
}

.btn-view {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-view.active,
.btn-view:hover {
    background-color: var(--primary);
    color: white;
}

/* Export Buttons */
.export-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn-export {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-export:hover {
    background-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Cards View */
.cards-view {
    display: grid;
    gap: 2rem;
}

.article-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.pillar-card {
    border: 2px solid var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-keyword {
    color: var(--highlight);
    font-weight: 600;
    font-size: 1.1rem;
}

.card-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-pillar {
    background-color: var(--primary);
    color: white;
}

.badge-beginner {
    background-color: var(--beginner);
    color: white;
}

.badge-intermediate {
    background-color: var(--warning);
    color: white;
}

.badge-advanced {
    background-color: var(--error);
    color: white;
}

.badge-type {
    background-color: rgba(203, 213, 225, 0.1);
    color: var(--text-secondary);
}

.card-section {
    margin-bottom: 1.5rem;
}

.card-section h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.card-section p,
.card-section li {
    color: var(--text-secondary);
    line-height: 1.8;
}

.card-section ul {
    list-style: none;
    padding-left: 0;
}

.card-section li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.card-section li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.highlight {
    background-color: rgba(96, 165, 250, 0.2);
    color: var(--highlight);
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    font-weight: 600;
}

/* JSON View */
.json-view {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    overflow-x: auto;
}

.json-view pre {
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Center Buttons */
.center-buttons {
    display: flex;
    justify-content: center;
    margin: 3rem 0;
}

.btn-home-large {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 3rem;
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-home-large:hover {
    background-color: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

/* History Section */
.history-section {
    margin-top: 3rem;
}

.history-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.history-container {
    display: grid;
    gap: 1rem;
}

.history-item {
    background-color: var(--bg-card);
    padding: 1.25rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.history-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-info {
    flex: 1;
}

.history-keyword {
    font-weight: 600;
    color: var(--highlight);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.history-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-reload {
    padding: 0.5rem 1.25rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

/* Footer Styles */
.site-footer {
    background-color: var(--bg-card);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
    border-top: 1px solid rgba(71, 85, 105, 0.5);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-column h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
    display: inline-block;
}

.footer-links a:hover,
.footer-links a:focus {
    color: var(--primary-hover);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}

.footer-link-highlight {
    color: var(--primary-hover);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link-highlight:hover,
.footer-link-highlight:focus {
    color: var(--primary);
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}

.footer-credit {
    margin-top: 1rem;
}

.footer-bottom {
    border-top: 1px solid rgba(71, 85, 105, 0.3);
    padding-top: 1.5rem;
    text-align: center;
}

.footer-bottom p {
    color: #64748b;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .site-header h1 {
        font-size: 1.2rem;
    }

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

    .btn-home-header {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .form-card {
        padding: 1.5rem;
    }

    .form-card h2 {
        font-size: 1.5rem;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-home-large {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .card-header {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .export-buttons {
        flex-direction: column;
    }

    .btn-export {
        width: 100%;
        justify-content: center;
    }
}