/* Mobile-specific styles for better mobile experience */

/* Prevent horizontal scrolling */
html, body {
    overflow-x: hidden;
    width: 100%;
    background-color: #000000 !important;
    color: #ffffff !important;
}

/* Better touch targets */
.btn, .form-control, .form-select, .list-group-item {
    min-height: 44px;
    touch-action: manipulation;
}

/* Mobile-specific spacing */
@media (max-width: 768px) {
    .section-padding {
        padding: 0 !important;
    }
    
    /* Мобільні відступи для секції новин */
    .news-section-padding {
        padding: 0 !important;
    }
    
    /* Мобільні відступи між головними секціями */
    .hero-section + .hero-section {
        margin-top: 0;
    }
    
    .hero-section + .news-section {
        margin-top: 0;
    }
    
    /* Додаткові стилі для зменшення відступів */
    .hero-section {
        margin-bottom: 0;
    }
    
    .hero-section {
        padding: 1rem 0;
        min-height: 30vh !important;
        background-size: cover !important;
        background-position: center !important;
    }
    
    /* Mobile hero image improvements */
    .hero-section[style*="background-image"] {
        background-size: cover !important;
        background-position: center !important;
        background-attachment: scroll !important;
    }
    
    /* Mobile hero overlay improvements */
    .hero-overlay {
        background-color: rgba(0, 0, 0, 0.5) !important;
    }
    
    /* Mobile hero text improvements */
    .hero-section h1 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-section .lead {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Mobile hero button improvements */
    .hero-section .btn {
        padding: 10px 16px !important;
        font-size: 0.9rem !important;
        width: auto !important;
        max-width: 200px !important;
        line-height: 1.2 !important;
        border-radius: 8px !important;
        white-space: normal !important;
        text-align: center !important;
    }
    /* Додаткова специфічність для великих кнопок у геро */
    .hero-section a.btn,
    .hero-section a.btn-lg {
        padding: 6px 12px !important;
        font-size: 13px !important;
        max-width: 200px !important;
    }

    /* Найвища специфічність для кнопок, що рендеряться з інлайн-стилем */
    .hero-section [data-mobile-pos="1"] a.btn,
    .hero-section [data-mobile-pos="1"] a.btn-lg {
        padding: 6px 12px !important;
        font-size: 13px !important;
        line-height: 1.2 !important;
        max-width: 200px !important;
        white-space: normal !important;
        display: inline-block !important;
    }

    /* Видалено глобальне центрування кнопок у всіх hero-секціях на мобільних,
       щоб не перезаписувати індивідуальні налаштування позиції з адмінки */
    
    /* Better mobile containers */
    .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Mobile card improvements */
    .card {
        border-radius: 12px;
        margin-bottom: 0.25rem !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .card-header {
        border-radius: 12px 12px 0 0;
        padding: 0.5rem !important;
    }
    
    .card-body {
        padding: 0.5rem !important;
    }
    
    /* Mobile button improvements */
    .btn {
        border-radius: 8px;
        font-weight: 600;
        text-transform: none;
        letter-spacing: 0.5px;
    }
    
    .btn-lg {
        padding: 15px 25px;
        font-size: 1.1rem;
    }
    
    /* Mobile button image overlay styles */
    .button-image-overlay {
        position: relative !important;
        display: block !important;
        z-index: 10 !important;
        margin: 10px 0 !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
    }
    
    .button-image-overlay img {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto !important;
    }
    
    /* Перевизначаємо абсолютне позиціонування на мобільних
       ТІЛЬКИ для елементів без спеціального атрибуту data-mobile-pos="1"
       (для яких позиції керуються з адмінки у відсотках) */
    .section-animation .button-image-overlay:not([data-mobile-pos="1"]),
    .hero-section .button-image-overlay:not([data-mobile-pos="1"]) {
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 20px 0 !important;
        text-align: center !important;
    }
    
    .section-animation .button-image-overlay:not([data-mobile-pos="1"]) a,
    .hero-section .button-image-overlay:not([data-mobile-pos="1"]) a {
        display: inline-block !important;
    }
    
    .section-animation .button-image-overlay img,
    .hero-section .button-image-overlay img {
        max-width: 80% !important;
        height: auto !important;
        opacity: 1 !important;
    }
    
    /* United24 button mobile styles - застосовувати лише, якщо НЕ ввімкнені мобільні відступи з адмінки */
    .united24-button:not([data-mobile-pos="1"]),
    .united24-button.button-image-overlay:not([data-mobile-pos="1"]),
    .button-image-overlay[style*="position: absolute"]:not([data-mobile-pos="1"]) {
        position: absolute !important;
        bottom: 370px !important;
        left: 20px !important;
        right: auto !important;
        top: auto !important;
        z-index: 1000 !important;
        margin: 0 !important;
        display: block !important;
    }
    
    .united24-button img,
    .united24-button.button-image-overlay img,
    .button-image-overlay[style*="position: absolute"] img {
        max-width: 50px !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto !important;
        border-radius: 5px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Ensure United24 button is visible on mobile */
    .united24-button:hover img {
        transform: scale(1.05) !important;
        opacity: 1 !important;
    }
    
    /* News list page mobile styles */
    .news-list-page.section-padding {
        padding: 24px 15px !important;
    }
    /* Ensure title isn't hidden under fixed header */
    .news-list-page .container {
        padding-top: 64px !important;
    }
    .news-list-page h1.display-5 { 
        margin-bottom: 8px !important; 
    }
    .news-list-page .lead { 
        margin-bottom: 16px !important; 
    }
    
    /* Tasks section mobile styles */
    .section h2.display-5 {
        font-size: 1.5rem !important;
        margin-bottom: 0 !important;
    }
    
    .section .lead {
        font-size: 0.9rem !important;
        margin-bottom: 0 !important;
    }
    
    /* Tasks cards mobile styles */
    .section .card {
        margin-bottom: 0 !important;
    }
    
    .section .card-body {
        padding: 0 !important;
    }
    
    .section .card-title {
        font-size: 1rem !important;
        margin-bottom: 0 !important;
    }
    
    .section .card-text {
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
    }
    
    /* News section mobile styles */
    .news-section {
        padding: 0 !important;
        margin-bottom: 0 !important;
        border-radius: 15px !important;
    }
    
    /* Заокруглення для блоку новин на мобільних */
    .news-section-padding {
        border-radius: 15px !important;
        overflow: hidden;
    }
    
    /* Стилі для єдиного блоку новин на мобільних */
    .news-section-container {
        border-radius: 25px !important;
        overflow: hidden;
        background-color: #1a1a1a !important;
        padding: 20px 40px 30px 40px !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
    
    /* Заокруглення для карток новин на мобільних */
    .news-card {
        border-radius: 12px !important;
        overflow: hidden;
    }
    
    /* Мобільні стилі для контейнера карток новин */
    .news-cards-container {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 16px;
        margin: 0 auto;
    }
    
    .news-card-item {
        width: 100%;
    }
    
    .news-section h3 {
        font-size: 1.25rem !important;
        margin-bottom: 0 !important;
    }
    
    /* Ensure all sections are visible on mobile */
    .section,
    .news-section {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Mobile form improvements */
    .form-control, .form-select {
        border-radius: 8px;
        border: 2px solid #e9ecef;
        transition: all 0.3s ease;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #000000;
        box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    }
    
    /* Mobile badge improvements */
    .badge {
        border-radius: 20px;
        font-weight: 600;
        padding: 0.25rem 0.5rem !important;
    }
    
    /* Mobile list improvements */
    .list-group-item {
        border-radius: 8px;
        margin-bottom: 0.25rem !important;
        border: 1px solid #e9ecef;
        padding: 0.5rem !important;
    }
    
    .list-group-item:first-child {
        border-radius: 8px 8px 0 0;
    }
    
    .list-group-item:last-child {
        border-radius: 0 0 8px 8px;
    }
    
    /* Mobile navigation improvements */
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
        font-weight: 700;
        height: 15px;
    }
    
    .navbar-brand img {
        max-height: 15px;
        width: auto;
        object-fit: contain;
    }
    
    .navbar-brand svg {
        max-height: 15px;
        width: auto;
        object-fit: contain;
    }
    
    .navbar-brand object {
        max-height: 15px;
        width: auto;
        object-fit: contain;
    }
    
    .navbar-nav .nav-link {
        font-weight: 500;
        padding: 0.75rem 1rem;
    }
    
    /* Mobile dropdown improvements */
    .dropdown-menu {
        background-color: #1a1a1a;
        border: 1px solid #333333;
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(255,255,255,0.15);
        margin-top: 0.5rem;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: auto !important;
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        overflow: visible !important;
        z-index: 1000 !important;
    }
    
    .dropdown-item {
        padding: 0.75rem 1.5rem;
        font-weight: 500;
        color: #ffffff;
    }
    
    .dropdown-item:hover {
        background-color: #333333;
        color: #ffffff;
    }
    
    /* Мобільні стилі для колонок dropdown - робимо простий список */
    .dropdown-menu .left-column,
    .dropdown-menu .right-column {
        background-color: transparent !important;
        padding: 0 !important;
        border-radius: 0 !important;
        grid-column: unset !important;
        min-height: auto !important;
        display: block !important;
        width: 100% !important;
        float: none !important;
    }
    
    /* Об'єднуємо всі елементи в один список */
    .dropdown-menu .left-column .dropdown-item,
    .dropdown-menu .right-column .dropdown-item {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    
    /* Приховуємо розділювач на мобільних */
    .dropdown-menu::before {
        display: none !important;
    }
    
    /* Mobile accessibility improvements */
    .btn:focus,
    .form-control:focus,
    .form-select:focus {
        outline: 2px solid #000000;
        outline-offset: 2px;
    }
    
    /* Mobile text improvements */
    h1, .h1 {
        font-weight: 700;
        line-height: 1.2;
    }
    
    h2, .h2 {
        font-weight: 600;
        line-height: 1.3;
    }
    
    h3, .h3 {
        font-weight: 600;
        line-height: 1.4;
    }
    
    /* Mobile spacing improvements */
    .mb-4 {
        margin-bottom: 2rem !important;
    }
    
    .mb-3 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-4 {
        margin-top: 2rem !important;
    }
    
    .mt-3 {
        margin-top: 1.5rem !important;
    }
    
    /* Mobile grid improvements */
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .col-md-6, .col-lg-4, .col-lg-8 {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Mobile sidebar improvements */
    .col-lg-4 {
        margin-top: 2rem;
    }
    
    /* Mobile icon improvements */
    .icon-wrapper {
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile contact improvements */
    .contact-icon {
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile stats improvements */
    .stats-number {
        font-weight: 700;
        line-height: 1;
    }
    
    /* Mobile breadcrumb improvements */
    .breadcrumb {
        background: transparent;
        padding: 0;
        margin-bottom: 1rem;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        color: rgba(255, 255, 255, 0.6);
        padding: 0 0.5rem;
    }
    
    .breadcrumb-item a {
        color: rgba(255, 255, 255, 0.8);
        text-decoration: none;
    }
    
    .breadcrumb-item.active {
        color: rgba(255, 255, 255, 1);
    }
}

/* Extra small devices */
@media (max-width: 576px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Extra small hero improvements */
    .hero-section {
        min-height: 50vh !important;
        padding: 2rem 0 !important;
    }
    
    .hero-section h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
        margin-bottom: 0.75rem !important;
    }
    
    .hero-section .lead {
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-section .btn {
        padding: 10px 20px !important;
        font-size: 0.9rem !important;
        width: 100% !important;
        max-width: none !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .card-header {
        padding: 0.75rem;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .btn-lg {
        padding: 15px 25px;
        font-size: 1.1rem;
    }
    
    /* Smaller text for very small screens */
    h1, .h1 {
        font-size: 1.5rem;
    }
    
    h2, .h2 {
        font-size: 1.25rem;
    }
    
    h3, .h3 {
        font-size: 1.1rem;
    }
    
    /* Compact spacing */
    .mb-4 {
        margin-bottom: 0.25rem !important;
    }
    
    .mb-3 {
        margin-bottom: 0.25rem !important;
    }
    
    /* Compact badges */
    .badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* Compact icons */
    .icon-wrapper {
        width: 32px;
        height: 32px;
    }
    
    /* Compact list items */
    .list-group-item {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.9rem;
    }
    
    /* Better touch targets for small screens */
    .btn, .form-control, .form-select {
        min-height: 48px;
    }
    
    /* Compact contact info */
    .contact-icon {
        width: 36px;
        height: 36px;
        margin-right: 8px;
    }
    
    /* Compact stats */
    .stats-number {
        font-size: 1.4rem;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: 1.5rem 0;
        min-height: 40vh !important;
    }
    
    .hero-section h1 {
        font-size: 1.5rem !important;
    }
    
    .hero-section .lead {
        font-size: 0.9rem !important;
    }
    
    .section-padding {
        padding: 0 !important;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card {
        border-width: 0.5px;
    }
    
    .btn {
        border-width: 0.5px;
    }
    
    .form-control, .form-select {
        border-width: 0.5px;
    }
}

/* Mobile image improvements */
@media (max-width: 768px) {
    /* News card images */
    .news-card img {
        height: 120px !important;
        object-fit: cover !important;
    }
    
    /* Feature images */
    .feature-card img {
        height: 120px !important;
        object-fit: cover !important;
    }
    
    /* Team member images */
    .team-member img,
    .card .card-img-top[style*="max-height"] {
        max-height: 350px !important;
        object-fit: cover !important;
    }
    
    /* General image improvements */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Card images */
    .card-img-top {
        max-height: 350px !important;
        object-fit: cover !important;
    }
    
    /* Background images */
    [style*="background-image"] {
        background-size: cover !important;
        background-position: center !important;
        background-attachment: scroll !important;
    }
}

/* Extra small devices image improvements */
@media (max-width: 576px) {
    .news-card img {
        height: 100px !important;
    }
    
    .feature-card img {
        height: 100px !important;
    }
    
    .team-member img,
    .card .card-img-top[style*="max-height"] {
        max-height: 300px !important;
    }
    
    .card-img-top {
        max-height: 300px !important;
    }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .card-header {
        background-color: #4a5568;
        border-color: #4a5568;
    }
    
    .form-control, .form-select {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .form-control:focus, .form-select:focus {
        background-color: #2d3748;
        border-color: #3182ce;
        color: #e2e8f0;
    }
    
    .list-group-item {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .text-muted {
        color: #a0aec0 !important;
    }
}
