/* Custom styles for AI Article Generator */

/* Article content styling */
.article-content {
    line-height: 1.8;
    font-size: 1.1rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

/* Loading states */
.btn:disabled {
    opacity: 0.7;
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    footer,
    .badge {
        display: none !important;
    }
    
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}

/* Enhanced card hover effects */
.card:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease-in-out;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-gray-800);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-gray-600);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* Improved form styling */
.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Enhanced button styles */
.btn {
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

/* Profile language buttons equal width */
.profile-language .btn-group {
    display: flex;
    width: 100%;
}

.profile-language .btn-group .btn {
    flex: 1;
    min-width: 0;
    max-width: 50%;
    width: 50%;
    height: 48px;
    min-height: 48px;
    text-align: center;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

/* Desktop styles */
@media (min-width: 769px) {
    .profile-language .btn-group .btn {
        min-width: 150px;
    }
}

/* Profile page action buttons equal height */
.profile-actions .btn {
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
}

/* Pagination styling */
.pagination {
    margin-bottom: 0;
}

.pagination .page-link {
    background-color: var(--bs-dark);
    border-color: var(--bs-gray-700);
    color: var(--bs-light);
}

.pagination .page-link:hover {
    background-color: var(--bs-gray-700);
    border-color: var(--bs-gray-600);
    color: var(--bs-white);
    transform: none; /* Отключаем поднятие для пагинации */
}

.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: var(--bs-white);
}

.pagination .page-item.disabled .page-link {
    background-color: var(--bs-gray-800);
    border-color: var(--bs-gray-700);
    color: var(--bs-gray-500);
}

/* Мобильная адаптация для кнопок выбора типа данных и SEO структуры */
.btn-group {
    display: flex !important;
    width: 100% !important;
    gap: 0 !important;
}

.btn-group .btn {
    flex: 1 1 50% !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 50% !important;
    max-width: 50% !important;
    min-width: 50% !important;
    box-sizing: border-box !important;
}

/* Переопределяем для конкретных селекторов */
.input-type-selector,
.seo-structure-selector {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 2px !important;
    width: 100% !important;
}

/* Точные размеры для кнопок - переопределяет все Bootstrap стили */
.input-type-selector .btn:first-child,
.input-type-selector .btn:last-child,
.seo-structure-selector .btn:first-child,
.seo-structure-selector .btn:last-child {
    width: 100% !important;
    height: 45px !important;
    min-height: 45px !important;
    max-height: 45px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 0.85rem !important;
    line-height: 1 !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    border-width: 1px !important;
}

.input-type-selector .btn,
.seo-structure-selector .btn {
    width: 100% !important;
    flex: none !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 0.25rem !important;
    font-size: 0.85rem !important;
    min-height: 45px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

/* Мобильные стили для кнопок выбора */
@media (max-width: 768px) {
    .btn-group .btn {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.25rem !important;
        min-height: 42px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 50% !important;
        flex: 0 0 50% !important;
    }
    
    .btn-group .btn i {
        margin-right: 0.25rem !important;
        font-size: 0.8rem !important;
    }
    
    .input-type-selector .btn,
    .seo-structure-selector .btn {
        max-width: 50% !important;
        flex: 0 0 50% !important;
        box-sizing: border-box !important;
    }
    
    /* Принудительно равные размеры для конкретных кнопок */
    .input-type-selector {
        border: none !important;
    }
    
    .input-type-selector .btn:first-child,
    .input-type-selector .btn:last-child {
        width: calc(50% - 1px) !important;
        flex: none !important;
        border-radius: 0.375rem !important;
        margin-right: 2px !important;
    }
    
    .input-type-selector .btn:last-child {
        margin-right: 0 !important;
        margin-left: 2px !important;
    }
    
    /* Скрыть иконки на очень маленьких экранах */
    @media (max-width: 480px) {
        .btn-group .btn i {
            display: none !important;
        }
        
        .btn-group .btn {
            font-size: 0.8rem !important;
            padding: 0.5rem 0.15rem !important;
        }
        
        .btn-group .btn span {
            font-size: 0.75rem !important;
        }
        
        .input-type-selector .btn,
        .seo-structure-selector .btn {
            font-size: 0.75rem !important;
            padding: 0 !important;
            height: 40px !important;
            min-height: 40px !important;
            max-height: 40px !important;
        }
        
        .input-type-selector .btn i,
        .seo-structure-selector .btn i {
            display: none !important;
        }
    }
    
    /* Дополнительные стили для создания статьи */
    .input-type-selector .btn,
    .seo-structure-selector .btn {
        min-height: 45px !important;
        border-width: 2px !important;
        flex-basis: 50% !important;
        flex-grow: 1 !important;
        flex-shrink: 1 !important;
    }
    
    .input-type-selector,
    .seo-structure-selector {
        display: flex !important;
        gap: 0 !important;
    }
    
    .input-type-selector .btn:checked,
    .seo-structure-selector .btn:checked,
    .btn-check:checked + .btn {
        background-color: var(--bs-primary) !important;
        border-color: var(--bs-primary) !important;
        color: white !important;
    }
    
    /* Language dropdown spacing on mobile */
    .navbar-nav .dropdown {
        margin-top: 0.75rem;
    }
    
    .navbar-nav .dropdown .nav-link {
        margin-top: 0.5rem;
    }
    
    /* Language buttons equal width on mobile */
    .profile-language .btn-group .btn {
        flex: 1;
        min-width: 0;
        max-width: 50%;
        width: 50%;
        height: 48px;
        min-height: 48px;
        text-align: center;
        font-size: 0.9rem;
        padding: 0.75rem 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }
}

/* Улучшенная видимость пагинации на мобильных устройствах */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-item {
        margin: 2px;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Project page specific styles */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stats-card {
    transition: transform 0.2s ease-in-out;
}

.stats-card:hover {
    transform: translateY(-2px);
}

.stats-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stats-number {
    font-weight: 700;
    font-size: 1.8rem;
}

.stats-label {
    font-weight: 500;
    font-size: 0.875rem;
}

.config-item {
    padding: 1rem;
    border-radius: 8px;
    background: #374151;
    border: 1px solid #4a5568;
    height: 100%;
}

.config-label {
    font-weight: 600;
    color: #d1d5db;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.config-value {
    color: #f9fafb;
    font-weight: 500;
}

.keywords-container {
    margin-top: 0.5rem;
}

.topic-title {
    font-weight: 500;
    line-height: 1.4;
    color: #f9fafb;
}

.table-modern {
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern tbody tr {
    transition: all 0.2s ease-in-out;
}

.table-modern {
    color: #f9fafb;
}

.table-modern tbody tr:hover {
    background-color: #374151;
    transform: scale(1.002);
}

.table-light {
    background-color: #4a5568;
    color: #f9fafb;
}

.table-light th {
    border-color: #6b7280;
}

.progress-lg {
    border-radius: 8px;
    overflow: hidden;
    background-color: #374151;
}

.bg-gradient {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.breadcrumb-light .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.5);
}

.text-white-75 {
    color: rgba(255, 255, 255, 0.75) !important;
}

.badge.fs-6 {
    font-size: 0.875rem !important;
}

/* Enhanced card shadows */
.shadow-sm {
    box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.1) !important;
}

/* Dark theme design */
body {
    background-color: #1a1d29;
    color: #e9ecef;
}

.card {
    background-color: #2d3748;
    border: 1px solid #4a5568;
}

.card-header {
    background-color: #374151 !important;
    border-bottom: 1px solid #4a5568;
    color: #f9fafb;
}

.text-muted {
    color: #9ca3af !important;
}

.text-dark {
    color: #f9fafb !important;
}

/* Dark theme modal and modal styling */
.modal-content {
    background-color: #2d3748;
    color: #f9fafb;
    border: 1px solid #4a5568;
}

.modal-header {
    border-bottom: 1px solid #4a5568;
}

.form-select {
    background-color: #374151;
    color: #f9fafb;
    border: 1px solid #4a5568;
}

.form-select:focus {
    background-color: #374151;
    border-color: #60a5fa;
    color: #f9fafb;
}

.btn-outline-primary {
    color: #60a5fa;
    border-color: #60a5fa;
}

.btn-outline-primary:hover {
    background-color: #60a5fa;
    border-color: #60a5fa;
}

.badge {
    font-weight: 500;
}

/* Keywords styling for dark theme */
.keywords-container .badge {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

/* Dark theme header badges */
.bg-gradient-primary .badge.bg-secondary {
    background-color: rgba(108, 117, 125, 0.8) !important;
    color: #f8f9fa !important;
    border: 1px solid rgba(108, 117, 125, 0.6);
}

/* Modal close button for dark theme */
.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Configuration card text styling for dark theme */
.config-item .config-label {
    color: #adb5bd !important;
    font-weight: 500;
}

.config-item .config-value {
    color: #f8f9fa !important;
    font-weight: 600;
}

/* Keywords container styling for dark theme */
.keywords-container .badge {
    color: #ffffff !important;
    background-color: rgba(13, 110, 253, 0.2) !important;
    border: 1px solid rgba(13, 110, 253, 0.4) !important;
}

/* Enhanced shadows for dark theme */
.shadow-sm {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2) !important;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .stats-number {
        font-size: 1.5rem;
    }
    
    .config-item {
        padding: 0.75rem;
    }
    
    .card-header h5 {
        font-size: 1.1rem;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    /* Navigation adjustments */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    /* Container padding */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Card spacing */
    .card {
        margin-bottom: 1rem;
        border-radius: 10px;
    }
    
    /* Responsive text */
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
    }
    
    /* Button adjustments */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Form adjustments */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    /* Table responsive */
    .table-responsive {
        font-size: 0.85rem;
    }
    
    /* Modal adjustments */
    .modal-dialog {
        margin: 1rem;
    }
    
    /* Progress bar mobile styling */
    .progress {
        height: 8px;
    }
    
    /* Badge adjustments */
    .badge {
        font-size: 0.75rem;
        padding: 0.35em 0.65em;
    }
    
    /* Article content mobile optimization */
    .article-content {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    /* Stats cards mobile layout */
    .row .col-md-3 {
        margin-bottom: 0.75rem;
    }
    
    /* Navigation menu mobile */
    .navbar-nav {
        padding-top: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Dropdown menu mobile */
    .dropdown-menu {
        border: none;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
    }
}

/* Small mobile devices */
@media (max-width: 576px) {
    /* Further reduce text sizes */
    h1, .h1 {
        font-size: 1.5rem;
    }
    
    h2, .h2 {
        font-size: 1.3rem;
    }
    
    /* Stack buttons vertically */
    .d-flex.gap-2 {
        flex-direction: column;
    }
    
    .d-flex.gap-2 .btn {
        margin-bottom: 0.5rem;
    }
    
    /* Full width elements */
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Adjust card padding */
    .card-body {
        padding: 1rem;
    }
    
    /* Table font size */
    .table {
        font-size: 0.8rem;
    }
    
    /* Container adjustments */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Navigation brand smaller */
    .navbar-brand {
        font-size: 1rem;
    }
    
    /* Stats display adjustment */
    .h2 {
        font-size: 1.75rem;
    }
    
    /* Form text smaller */
    .form-text {
        font-size: 0.8rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        padding: 0.75rem 1rem;
    }
    
    /* Improve form controls for touch */
    .form-control {
        min-height: 44px;
    }
    
    .form-select {
        min-height: 44px;
    }
}

/* Progressive Web App optimizations */
@media screen and (max-device-width: 480px) {
    body {
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }
    
    /* Prevent horizontal scrolling */
    .container-fluid {
        overflow-x: hidden;
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
    }
}

/* High DPI display optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    .btn {
        border-width: 0.5px;
    }
    
    .card {
        border-width: 0.5px;
    }
}

/* Dark mode mobile adjustments */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .card {
        background-color: var(--bs-dark);
        border-color: var(--bs-gray-700);
    }
    
    .table-responsive {
        border: 1px solid var(--bs-gray-700);
        border-radius: 8px;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Larger focus indicators */
    .btn:focus,
    .form-control:focus,
    .form-select:focus {
        box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.5);
    }
    
    /* Better link spacing */
    .nav-link {
        padding: 1rem 0.5rem;
    }
    
    /* Improved readability */
    .text-muted {
        color: var(--bs-gray-400) !important;
    }
}

/* Article section spacing */
article section {
    scroll-margin-top: 100px;
}

/* Badge styling */
.badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Input group enhancements */
.input-group .btn {
    border-radius: 0 8px 8px 0;
}

.input-group .form-control {
    border-radius: 8px 0 0 8px;
}

.input-group-text {
    border-radius: 8px 0 0 8px;
    background-color: var(--bs-gray-800);
    border-color: var(--bs-gray-700);
}

/* Alert styling */
.alert {
    border-radius: 8px;
}

/* Navigation enhancements */
.navbar-brand {
    font-weight: 600;
}

/* Footer styling */
footer {
    margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .article-content {
        font-size: 1rem;
    }
    
    .card-body.p-5 {
        padding: 2rem !important;
    }
}

/* Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Success states */
.btn-success {
    --bs-btn-bg: var(--bs-success);
    --bs-btn-border-color: var(--bs-success);
}

/* Custom utility classes */
.text-justify {
    text-align: justify;
}

.border-radius-lg {
    border-radius: 12px !important;
}

/* Focus improvements for accessibility */
.btn:focus,
.form-control:focus,
.btn-check:focus + .btn {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}
