* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
}

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

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

/* Навигация */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: var(--border);
}

/* Кнопки */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

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

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Основной контент */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

/* Заголовки */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-muted);
}

/* Поиск и фильтры */
.search-section {
    margin-bottom: 2rem;
}

.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tag {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

.filter-tag:hover {
    border-color: var(--primary);
}

.filter-tag.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Сетка карточек */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

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

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

.card-category {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    background: var(--border);
    color: var(--text-muted);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card-description {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Детальная страница */
.detail-container {
    max-width: 800px;
    margin: 0 auto;
}

.detail-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.detail-icon {
    font-size: 4rem;
}

.detail-info h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.detail-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.tag {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    background: var(--border);
    color: var(--text);
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.detail-item {
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
}

.detail-item-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.detail-item-value {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Формы */
.form {
    max-width: 600px;
    margin: 0 auto;
}

.form-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-label.required::after {
    content: " *";
    color: var(--danger);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-error {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Loading состояние */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-top: 1rem;
    color: var(--text-muted);
}

/* Error состояние */
.error-container {
    text-align: center;
    padding: 4rem 2rem;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.error-message {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Empty состояние */
.empty-container {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-message {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Toast уведомления */
.toast-container {
    position: fixed;
    top: 80px;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

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

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.warning {
    border-color: var(--warning);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.toast-message {
    flex: 1;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s;
}

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

.modal {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    animation: scaleIn 0.3s;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.modal-content {
    margin-bottom: 2rem;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Адаптивность */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

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

    .search-bar {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
    }

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