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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.navbar {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: #333;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: #666;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #333;
}

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

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

h1 {
    margin-bottom: 2rem;
    color: #333;
}

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

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 1rem;
    color: #333;
}

.card-content p {
    margin-bottom: 0.5rem;
}

.card-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* File upload */
.upload-section {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.file-upload {
    margin-bottom: 1rem;
}

.file-upload input[type="file"] {
    display: none;
}

.file-label {
    display: block;
    padding: 2rem;
    border: 2px dashed #ddd;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-label:hover {
    border-color: #007bff;
}

.file-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Results table */
.results-table-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.results-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.image-cell img {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
}

.error-placeholder {
    color: #dc3545;
    font-weight: 500;
}

.status-success {
    color: #28a745;
    font-weight: 500;
}

.status-error {
    color: #dc3545;
    font-weight: 500;
}

.url-cell {
    max-width: 300px;
}

.url-link {
    color: #007bff;
    text-decoration: none;
    word-break: break-all;
}

.url-link:hover {
    text-decoration: underline;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state h2 {
    margin-bottom: 1rem;
    color: #666;
}

/* Validation info */
.validation-info {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.validation-info h3 {
    margin-bottom: 1rem;
    color: #333;
}

.validation-info ul {
    list-style-position: inside;
}

.validation-info li {
    margin-bottom: 0.5rem;
}

/* Success/error colors */
.success {
    color: #28a745;
    font-weight: 500;
}

.error {
    color: #dc3545;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .results-table {
        font-size: 0.9rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.5rem;
    }
}

/* Progress page styles */
.progress-section {
    max-width: 600px;
    margin: 0 auto;
}

.progress-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.progress-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-processing {
    background: #fff3cd;
    color: #856404;
}

.status-completed {
    background: #d1edff;
    color: #004085;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.status-cancelling {
    background: #fff3cd;
    color: #856404;
}

.progress-bar-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #007bff;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: -25px;
    right: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
}

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

.detail-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.detail-label {
    color: #666;
    font-size: 0.9rem;
}

.detail-value {
    font-weight: 500;
}

.memory-usage {
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.actions {
    text-align: center;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

/* Errors section */
.errors-section {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-top: 2rem;
}

.errors-section h3 {
    margin-bottom: 1rem;
    color: #dc3545;
}

.errors-list {
    max-height: 200px;
    overflow-y: auto;
}

.error-item {
    padding: 0.75rem;
    background: #f8f9fa;
    border-left: 4px solid #dc3545;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
}

.error-item:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .progress-details {
        grid-template-columns: 1fr;
    }
    
    .progress-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* Results controls */
.results-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.results-info {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.results-info p {
    margin: 0;
    font-size: 0.9rem;
}

.success-count {
    color: #28a745;
    font-weight: 500;
}

.error-count {
    color: #dc3545;
    font-weight: 500;
}

.filter-controls {
    display: flex;
    gap: 1rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid transparent;
    background: #f8f9fa;
    color: #333;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: #e9ecef;
}

.filter-btn.active {
    border-color: #007bff;
    background: #007bff;
    color: white;
}

/* Result rows */
.result-row.status-success {
    background: #f8fff9;
}

.result-row.status-error {
    background: #fff5f5;
}

/* Responsive */
@media (max-width: 768px) {
    .results-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .results-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .filter-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .filter-btn {
        flex: 1;
        text-align: center;
    }
}

/* Кастомная модалка */
.custom-modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 400px;
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.custom-modal-header {
    padding: 1.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.custom-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2rem;
}

.custom-modal-body {
    padding: 1.5rem;
}

.custom-modal-body p {
    margin: 0;
    line-height: 1.5;
    color: #666;
}

.custom-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Модалка для деталей (уже существующая) */
.modal {
    position: fixed;
		justify-content: center;
		align-items: center;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: #fefefe;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: #aaa;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 1.5rem;
		max-height: 80vh;
		overflow-y: auto;
}

/* Блокировка прокрутки при открытых модальных окнах */
body.modal-open {
    overflow: hidden;
    /* position: fixed; */
    width: 100%;
    height: 100%;
    top: var(--scroll-top, 0);
    left: 0;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    text-align: right;
}

/* Стили для disabled кнопок */
.btn:disabled {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: #fff !important;
    cursor: not-allowed !important;
    opacity: 0.65 !important;
    pointer-events: none !important;
}

.btn-primary:disabled {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    opacity: 0.65 !important;
}

.btn-secondary:disabled {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    opacity: 0.65 !important;
}

.btn-danger:disabled {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    opacity: 0.65 !important;
}

.btn-outline:disabled {
    background-color: transparent !important;
    border-color: #6c757d !important;
    color: #6c757d !important;
    opacity: 0.65 !important;
}

.btn-sm:disabled {
    opacity: 0.65 !important;
}

/* Ховер эффекты для активных кнопок */
.btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

/* Плавные переходы для всех кнопок */
.btn {
    transition: all 0.2s ease-in-out;
}

/* Специфичные стили для кнопок в таблице */
.actions .btn:disabled {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
}

/* Стили для кнопок в модальных окнах */
.modal-footer .btn:disabled,
.custom-modal-footer .btn:disabled {
    opacity: 0.5;
}

/* Индикатор загрузки для disabled кнопок */
.btn:disabled::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* Для outline кнопок меняем цвет спиннера */
.btn-outline:disabled::after {
    border-top: 2px solid #6c757d;
}

/* Убираем спиннер для кнопок без текста "Генерируется..." */
.btn:disabled:not([class*="generating"])::after {
    display: none;
}
