/**
 * Google Sign-In FedCM Widget Styles
 * Плавающий виджет без затемнения и блокировки скролла
 */

/* Явно разрешаем скроллинг страницы */
html,
body {
    overflow: auto !important;
    overflow-x: hidden !important;
    position: relative !important;
}

/* Основной контейнер виджета - скрыт по умолчанию */
.gsfedcm-widget {
    display: none;
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    bottom: 20px;
    right: 20px;
    left: auto;
    top: auto;
    width: 350px;
    max-width: 400px;
    margin: 0;
    transform: none;
}

/* Виджет показан */
.gsfedcm-widget.show {
    display: block !important;
    pointer-events: auto;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Контент виджета */
.gsfedcm-widget-content {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    position: relative;
    width: 100%;
    max-width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    box-sizing: border-box;
}

/* Тело виджета */
.gsfedcm-widget-body {
    padding: 14px 20px 20px 20px;
    text-align: center;
    box-sizing: border-box;
    overflow: hidden;
}

.gsfedcm-widget-body h3 {
    margin: 0 0 15px 0;
    padding-top: 14px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    line-height: 1.4;
    text-decoration: none;
    border: none;
    outline: none;
}

/* Кнопка закрытия */
.gsfedcm-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: #8b7355;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 100000 !important;
    padding: 0;
    pointer-events: auto !important;
}

.gsfedcm-close:hover,
.gsfedcm-close:focus {
    color: #5d4e37;
    background-color: #f5f3f0;
}

/* Контейнер для кнопки Google */
#gsfedcm-button-container {
    margin: 15px 0;
    display: block;
    min-height: 50px;
    width: 100%;
    max-width: 100%;
    text-align: center;
    box-sizing: border-box;
    position: relative;
}

/* Стили для всех прямых дочерних элементов контейнера */
#gsfedcm-button-container > * {
    box-sizing: border-box !important;
    display: block !important;
}

#gsfedcm-button-container > div {
    display: block !important;
    box-sizing: border-box !important;
    position: relative !important;
}

/* Стили для div с role="button", который создает Google */
#gsfedcm-button-container div[role="button"] {
    box-sizing: border-box !important;
    display: block !important;
    position: relative !important;
}

/* Стили для всех вложенных элементов */
#gsfedcm-button-container * {
    box-sizing: border-box !important;
}

/* Стили для iframe */
#gsfedcm-button-container iframe {
    margin: 0 !important;
    display: block !important;
    box-sizing: border-box !important;
    position: relative !important;
    border: none !important;
}

/* Мобильные устройства - растягивание на всю ширину */
@media screen and (max-width: 768px) {
    #gsfedcm-button-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 15px 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 15px !important;
        margin-bottom: 15px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: block !important;
        justify-content: unset !important;
        align-items: unset !important;
        overflow: hidden !important;
    }
    
    #gsfedcm-button-container > *,
    #gsfedcm-button-container > div,
    #gsfedcm-button-container div[role="button"],
    #gsfedcm-button-container iframe {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Дополнительные стили для всех вложенных элементов */
    #gsfedcm-button-container div {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Специфичные стили для iframe на мобильных */
    #gsfedcm-button-container iframe {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Сообщения */
.gsfedcm-message {
    display: none;
    margin-top: 15px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
}

.gsfedcm-message.show {
    display: block;
}

.gsfedcm-message-info {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

.gsfedcm-message-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #81c784;
}

.gsfedcm-message-error {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
}

/* Desktop: правый нижний угол, ширина 350-400px */
@media screen and (min-width: 769px) {
    .gsfedcm-widget {
        bottom: 20px !important;
        right: 20px !important;
        left: auto !important;
        top: auto !important;
        width: 350px !important;
        max-width: 400px !important;
        position: fixed !important;
    }
    
    .gsfedcm-widget-content {
        animation: slideInRight 0.3s ease;
    }
    
    @keyframes slideInRight {
        from {
            transform: translateX(100%);
            opacity: 0;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }
}

/* Mobile: банер снизу, полная ширина */
@media screen and (max-width: 768px) {
    .gsfedcm-widget {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        position: fixed !important;
        margin: 0 !important;
        transform: none !important;
    }
    
    .gsfedcm-widget-content {
        border-radius: 12px 12px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
        border: 1px solid rgba(0, 0, 0, 0.05);
        border-bottom: none;
        animation: slideUp 0.3s ease;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .gsfedcm-widget-body {
        padding: 10px 15px;
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }
    
    /* Контейнер кнопки на мобильных - используем всю доступную ширину внутри padding */
    .gsfedcm-widget-body #gsfedcm-button-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Убеждаемся, что все элементы внутри контейнера не выходят за границы */
    .gsfedcm-widget-body #gsfedcm-button-container > *,
    .gsfedcm-widget-body #gsfedcm-button-container > div,
    .gsfedcm-widget-body #gsfedcm-button-container div[role="button"],
    .gsfedcm-widget-body #gsfedcm-button-container iframe {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .gsfedcm-widget-body h3 {
        font-size: 16px;
        margin: 0 0 12px 0;
        color: #2c3e50;
        text-align: center;
        line-height: 1.4;
        text-decoration: none;
        border: none;
        outline: none;
    }
    
    .gsfedcm-close {
        font-size: 20px;
        width: 28px;
        height: 28px;
        top: 8px;
        right: 8px;
    }
}

