/* Reset en basis styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #326ce5;
    --primary-dark: #1e4ba8;
    --secondary-color: #f8f9fa;
    --accent-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

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

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

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.header__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header__icon {
    font-size: 2rem;
}

.header__subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main content */
.main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 3rem 0;
}

.loading__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error state */
.error {
    text-align: center;
    padding: 3rem 0;
    color: var(--danger-color);
}

.error__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error h2 {
    margin-bottom: 1rem;
}

/* Controls */
.controls {
    margin-bottom: 2rem;
}

.search-box {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.search-box__input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.search-box__input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(50, 108, 229, 0.1);
}

.search-box__icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Repository info */
.repo-info {
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.repo-info h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.repo-info__item {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.repo-info__commands h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.code-block {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    position: relative;
    margin-top: 0.5rem;
}

.code-block code {
    display: block;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Buttons */
.button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.button--small {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.button--primary {
    background: var(--primary-color);
}

/* Charts container */
.charts-container h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* Chart card */
.chart-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

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

.chart-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.chart-card__name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.chart-card__version {
    background: var(--accent-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.chart-card__description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.chart-card__keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.chart-card__keyword {
    background: var(--secondary-color);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

.chart-card__meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.chart-card__install {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    position: relative;
}

.chart-card__install-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.chart-card__install code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.8rem;
    display: block;
    word-break: break-all;
}

.chart-card__copy {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
}

/* No results */
.no-results {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-secondary);
}

.no-results__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header__title {
        font-size: 2rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .chart-card {
        padding: 1rem;
    }
    
    .repo-info__item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-box {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 0;
    }
    
    .header__title {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .chart-card__header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .chart-card__meta {
        grid-template-columns: 1fr;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal__content {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--secondary-color);
}

.modal__header h2 {
    margin: 0;
    color: var(--primary-color);
}

.modal__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.modal__close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal__body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.modal__error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--danger-color);
    text-align: center;
}

.modal__values {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal__actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--secondary-color);
}

.values-yaml {
    flex: 1;
    margin: 0;
    padding: 1.5rem;
    background: #f8f9fa;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    border: none;
}

/* Chart card improvements */
.chart-card {
    cursor: pointer;
    transition: var(--transition);
}

.chart-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.chart-card__view-values {
    margin-top: 1rem;
    padding: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    width: 100%;
}

.chart-card__view-values:hover {
    background: var(--primary-dark);
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal__content {
        width: 100%;
        max-height: 95vh;
    }
    
    .modal__header {
        padding: 1rem;
    }
    
    .modal__actions {
        padding: 0.75rem;
    }
    
    .values-yaml {
        padding: 1rem;
        font-size: 0.8rem;
    }
}

/* Utility classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }