/* static/css/style.css */
body {
    background-color: #f8f9fa;
}

.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

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

.ua-string {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    border-left: 4px solid #007bff;
}

.stats-card {
    border-left: 4px solid #28a745;
}

.cache-card {
    border-left: 4px solid #ffc107;
}

.valid-badge {
    font-size: 0.8em;
}

.ua-list {
    max-height: 400px;
    overflow-y: auto;
}

.platform-badge {
    font-size: 0.7em;
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.5s;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
}

/* Hero Section */
.hero-icon {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Feature Cards */
.feature-card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

.feature-icon {
    opacity: 0.9;
}

/* Platform Items */
.platform-item {
    padding: 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.platform-item:hover {
    background-color: #f8f9fa;
    transform: scale(1.05);
}

/* Browser Badges */
.badge {
    font-size: 0.8em;
    padding: 0.5em 0.8em;
}

.bg-chrome { background-color: #4285F4; }
.bg-firefox { background-color: #FF7139; }
.bg-safari { background-color: #000000; }
.bg-edge { background-color: #0078D7; }
.bg-opera { background-color: #FF1B2D; }
.bg-samsung { background-color: #1428A0; }

/* Responsive */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Animation classes */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Generate Page Specific Styles */
.page-header {
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 1.5rem;
}

.stat-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-badge .fw-bold {
    font-size: 1.5rem;
    display: block;
}

.configuration-panel {
    position: sticky;
    top: 2rem;
    transition: all 0.3s ease;
}

.configuration-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.strategy-select option {
    padding: 10px;
    border-bottom: 1px solid #e9ecef;
}

.strategy-description {
    font-size: 0.85rem;
    line-height: 1.4;
    border-left: 3px solid #007bff;
    transition: all 0.3s ease;
}

.advanced-options {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
}

.advanced-options a {
    color: #6c757d;
    transition: color 0.3s ease;
}

.advanced-options a:hover {
    color: #007bff;
}

.advanced-options a[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

.advanced-options a[aria-expanded="true"] {
    color: #007bff;
}

.generate-btn {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
    padding: 1rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.4);
}

.generate-btn:active {
    transform: translateY(0);
}

/* Results Styles */
.stat-item {
    padding: 1rem;
}

.stat-value {
    font-size: 2rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.ua-list-container {
    max-height: 600px;
    overflow-y: auto;
    border-radius: 0 0 0.375rem 0.375rem;
}

.ua-item {
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.ua-item:hover {
    background-color: #f8f9fa;
    border-left-color: #007bff;
    transform: translateX(5px);
}

.ua-platform-badge {
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    min-width: 40px;
    text-align: center;
}

.ua-platform-badge i {
    font-size: 1.2rem;
}

.ua-string {
    font-family: 'Courier New', Monaco, monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    background: transparent;
    border: none;
    padding: 0;
    word-break: break-all;
}

.ua-meta {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ua-item:hover .ua-meta {
    opacity: 1;
}

.ua-actions {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ua-item:hover .ua-actions {
    opacity: 1;
}

.copy-ua {
    transition: all 0.3s ease;
}

.copy-ua:hover {
    transform: scale(1.1);
    background-color: #007bff !important;
    color: white !important;
}

/* Platform Distribution */
.platform-dist-item {
    padding: 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.platform-dist-item:hover {
    border-color: #e9ecef;
    background-color: #f8f9fa;
    transform: translateY(-3px);
}

.platform-count {
    color: #495057;
}

.platform-name {
    letter-spacing: 0.5px;
}

/* Browser Badges with Colors */
.bg-chrome { 
    background: linear-gradient(135deg, #4285F4, #34A853) !important; 
    color: white !important;
}

.bg-firefox { 
    background: linear-gradient(135deg, #FF7139, #FFA000) !important;
    color: white !important;
}

.bg-safari { 
    background: linear-gradient(135deg, #000000, #434343) !important;
    color: white !important;
}

.bg-edge { 
    background: linear-gradient(135deg, #0078D7, #00A4EF) !important;
    color: white !important;
}

.bg-opera { 
    background: linear-gradient(135deg, #FF1B2D, #A50034) !important;
    color: white !important;
}

/* Animation Classes */
.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

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

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* Responsive Design */
@media (max-width: 991.98px) {
    .configuration-panel {
        position: static;
        margin-bottom: 2rem;
    }
    
    .ua-string {
        font-size: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .page-header .display-5 {
        font-size: 2rem;
    }
    
    .generate-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .ua-item {
        padding: 0.75rem;
    }
    
    .ua-platform-badge {
        min-width: 35px;
    }
}

/* Scrollbar Styling */
.ua-list-container::-webkit-scrollbar {
    width: 6px;
}

.ua-list-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ua-list-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ua-list-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Validate Page Specific Styles */
.validation-panel {
    position: sticky;
    top: 2rem;
    transition: all 0.3s ease;
}

.validation-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.ua-textarea {
    font-family: 'Courier New', Monaco, monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
    min-height: 120px;
}

.ua-raw {
    font-family: 'Courier New', Monaco, monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    word-break: break-all;
    white-space: pre-wrap;
    background: #f8f9fa !important;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.validate-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    padding: 1rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.validate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40,167,69,0.4);
}

.validate-btn:active {
    transform: translateY(0);
}

/* Validation Results Styles */
.score-visualization .progress {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.score-visualization .progress-bar {
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

.info-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    transition: all 0.3s ease;
    height: 100%;
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-color: #007bff;
}

.error-list, .warning-list {
    max-height: 200px;
    overflow-y: auto;
}

.error-item, .warning-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.error-item {
    background: rgba(220,53,69,0.05);
    border-left-color: #dc3545;
}

.warning-item {
    background: rgba(255,193,7,0.05);
    border-left-color: #ffc107;
}

.error-item:hover, .warning-item:hover {
    transform: translateX(5px);
}

/* Sample buttons animations */
.btn-outline-primary.text-start {
    transition: all 0.3s ease;
    text-align: left !important;
    position: relative;
    overflow: hidden;
}

.btn-outline-primary.text-start:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(0,123,255,0.2);
}

.btn-outline-primary.text-start::before {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-outline-primary.text-start:hover::before {
    left: 100%;
}

/* Character counter */
#charCount {
    font-weight: 600;
    color: #495057;
}

/* Platform icons styling */
.fa-windows.text-primary { color: #0078d4 !important; }
.fa-apple.text-dark { color: #000000 !important; }
.fa-linux.text-warning { color: #f0ad4e !important; }
.fa-android.text-success { color: #3ddc84 !important; }
.fa-mobile-alt.text-info { color: #17a2b8 !important; }

/* Responsive design for validate page */
@media (max-width: 991.98px) {
    .validation-panel {
        position: static;
        margin-bottom: 2rem;
    }
    
    .info-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 767.98px) {
    .validate-btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .ua-textarea {
        font-size: 0.8rem;
    }
    
    .score-visualization .progress {
        height: 16px;
    }
}

/* Loading animation for validate button */
.validate-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.validate-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Enhanced copy button */
.btn-outline-light.copy-btn {
    transition: all 0.3s ease;
}

.btn-outline-light.copy-btn:hover {
    background-color: #ffffff !important;
    color: #343a40 !important;
    transform: scale(1.05);
}

/* Validation level indicators */
.validation-level-item {
    padding: 0.75rem;
    border: 2px solid transparent;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.validation-level-item:hover {
    border-color: #e9ecef;
    background-color: #f8f9fa;
}

.validation-level-item .form-check-input:checked ~ .form-check-label {
    color: #007bff;
    font-weight: 600;
}

.validation-level-item .form-check-input:checked {
    background-color: #007bff;
    border-color: #007bff;
}
/* ФИКС ДЛЯ МОБИЛЬНОЙ ВЕРСИИ */
@media (max-width: 991.98px) {
    .configuration-panel {
        margin-bottom: 2rem;
        position: static !important;
    }
    
    /* Увеличиваем отступ между кнопкой и блоком статистики */
    .configuration-panel .card-body {
        padding-bottom: 2rem;
    }
    
    /* Делаем кнопку более компактной но видимой */
    #generateMassive {
        min-height: 60px !important;
        padding: 1rem 1.5rem !important;
        font-size: 1.1rem !important;
        margin: 1.5rem 0 !important;
    }
    
    /* Блоку статистики задаем четкий отступ */
    .configuration-panel + .card {
        margin-top: 2rem !important;
        clear: both;
    }
    
    /* Убеждаемся что блоки не перекрываются */
    .col-lg-4 .card:not(:first-child) {
        margin-top: 2rem;
    }
}

/* Еще более специфичные стили для очень маленьких экранов */
@media (max-width: 576px) {
    .configuration-panel {
        margin-bottom: 3rem;
    }
    
    #generateMassive {
        min-height: 55px !important;
        padding: 0.875rem 1.25rem !important;
        font-size: 1rem !important;
        margin: 2rem 0 !important;
    }
    
    /* Делаем блок статистики более компактным */
    .configuration-panel + .card .card-body {
        padding: 1rem;
    }
    
    .configuration-panel + .card {
        margin-top: 2.5rem !important;
    }
}

/* Гарантируем правильный поток элементов */
.configuration-panel .card-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Явно задаем порядок элементов в мобильной версии */
@media (max-width: 991.98px) {
    .configuration-panel .card-body {
        gap: 2rem;
    }
    
    /* Кнопка генерации должна быть перед статистикой */
    #generateMassive {
        order: 5;
    }
    
    /* Прогресс-бар после кнопки */
    #progressContainer {
        order: 6;
    }
    
    /* Статистика в самом конце */
    .configuration-panel + .card {
        order: 7;
    }
}

/* Убираем sticky на мобильных */
@media (max-width: 991.98px) {
    .configuration-panel {
        position: static !important;
        top: auto !important;
    }
}

/* Дополнительная защита от наложения */
.configuration-panel, 
.configuration-panel + .card {
    position: relative;
    z-index: auto;
}

/* Четкие отступы между карточками */
.col-lg-4 .card {
    margin-bottom: 2rem;
}

.col-lg-4 .card:last-child {
    margin-bottom: 0;
}
.configuration-panel + .card {
    margin-top: 3rem !important; /* Большой отступ между настройками и статистикой */
}

/* === ГАРАНТИРУЕМ ЧТО КНОПКА ВИДНА === */
#generateMassive {
    margin: 2rem 0 !important; /* Отступ сверху и снизу для кнопки */
    position: relative !important;
    z-index: 100 !important;
}

/* === УБИРАЕМ ВОЗМОЖНЫЕ НАЛОЖЕНИЯ === */
.configuration-panel {
    position: relative !important;
}

.configuration-panel + .card {
    position: relative !important;
}

/* === ДЕСКТОПНАЯ ВЕРСИЯ === */
@media (min-width: 992px) {
    .configuration-panel + .card {
        margin-top: 2rem !important; /* Чуть меньше отступ на десктопе */
    }
}