/* ---
 * AP News Banner - Frontend Styles
 * ---
 */

/* 1. Banner
--------------------------------------------- */
.apnb-banner-container {
    width: 100%;
    position: fixed;
    left: 0;
    right: 0;
}
.apnb-position-top { top: 0; }
.apnb-position-bottom { bottom: 0; }

/* Admin Bar Compatibility */
body.admin-bar .apnb-position-top {
    top: 32px;
}
@media screen and (max-width: 782px) {
    body.admin-bar .apnb-position-top {
        top: 46px;
    }
}

.apnb-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.apnb-banner .apnb-content {
    flex-grow: 1;
    text-align: center;
}

.apnb-banner .apnb-title {
    font-weight: 500;
}

/* Ticker Animation */
.apnb-ticker-wrap {
    display: flex;
    align-items: stretch;
}

.apnb-ticker-prefix {
    font-weight: bold;
    white-space: nowrap;
    padding: 0 15px;
    display: flex;
    align-items: center;
}

.apnb-ticker-content-wrap {
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.apnb-ticker-content {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    animation: apnb-ticker 30s linear infinite;
}

.apnb-ticker-content:hover {
    animation-play-state: paused;
}

.apnb-ticker-item {
    display: inline-block;
    vertical-align: middle;
}

.apnb-ticker-separator {
    display: inline-block;
    padding: 0 20px;
    vertical-align: middle;
    font-weight: bold;
    opacity: 0.7;
}

.apnb-ticker-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.apnb-animation-ticker .apnb-banner .apnb-close {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    margin: 0;
    z-index: 20;
}

@keyframes apnb-ticker {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-50%, 0, 0); }
}

/* 2. Popup
--------------------------------------------- */
.apnb-popup-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.apnb-popup-container.apnb-visible {
    opacity: 1;
    visibility: visible;
}

.apnb-popup {
    position: relative;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s;
}

.apnb-visible .apnb-popup {
    transform: scale(1);
}

.apnb-popup .apnb-title {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.apnb-popup .apnb-content {
    line-height: 1.6;
}

.apnb-popup .apnb-popup-footer {
    margin-top: 20px;
    text-align: right;
}

body.apnb-popup-open {
    overflow: hidden;
}

/* 3. Ribbon
--------------------------------------------- */
.apnb-ribbon {
    position: fixed;
    padding: 8px 40px;
    z-index: 99998;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center;
    text-decoration: none;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;
}

.apnb-position-top-right { top: 35px; right: -35px; transform: rotate(45deg); }
.apnb-position-top-left { top: 35px; left: -35px; transform: rotate(-45deg); }
.apnb-position-bottom-right { bottom: 35px; right: -35px; transform: rotate(-45deg); }
.apnb-position-bottom-left { bottom: 35px; left: -35px; transform: rotate(45deg); }

/* 4. Slider
--------------------------------------------- */
.apnb-slider-container {
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.apnb-slider {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.apnb-slide {
    flex: 0 0 100%;
    box-sizing: border-box;
    padding: 0 40px; /* Space for arrows */
    text-align: center;
}

.apnb-slide .apnb-title {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.apnb-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.1);
    border: none;
    color: #333;
    font-size: 24px;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 4px;
    z-index: 10;
}
.apnb-slider-arrow:hover { background: rgba(0,0,0,0.2); }
.apnb-slider-prev { left: 10px; }
.apnb-slider-next { right: 10px; }

.apnb-slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
}

.apnb-slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    border: none;
    margin: 0 5px;
    cursor: pointer;
    padding: 0;
}
.apnb-slider-dot.active { background: rgba(0,0,0,0.5); }

/* 5. Elementi Comuni (Pulsanti)
--------------------------------------------- */
.apnb-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
}
.apnb-banner .apnb-close { position: static; margin-left: 15px; }
.apnb-close:hover { opacity: 1; }

.apnb-button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
    cursor: pointer;
    transition: opacity 0.2s;
    border: none;
}

.apnb-banner .apnb-button {
    background-color: rgba(255, 255, 255, 0.9);
    color: #1d2327;
    margin-left: 15px;
}

.apnb-popup .apnb-button {
    background-color: #4f46e5; /* Primary color from admin */
    color: #ffffff;
}

.apnb-slider .apnb-button {
    background-color: #4f46e5;
    color: #ffffff;
    margin-top: 15px;
}

.apnb-button:hover {
    opacity: 0.9;
}

/* Blink Animation */
.apnb-blink {
    animation: apnb-blink-animation 1.5s linear infinite;
}

@keyframes apnb-blink-animation {
    0% { opacity: 1; }
    50% { opacity: 0; }
    100% { opacity: 1; }
}

/* Frontend Form */
.apnb-frontend-form-wrapper {
    width: 100%;
    margin: 20px 0;
    padding: 30px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

.apnb-info-box {
    background-color: #e0f2fe; /* Light blue similar to Amazon info */
    border-left: 5px solid #0284c7;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 4px;
    color: #0c4a6e;
}

.apnb-info-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #0369a1;
    font-size: 1.1em;
}

.apnb-info-box-small {
    font-size: 0.9em;
    padding: 10px 15px;
    background-color: #f0f9ff;
    border-left-color: #38bdf8;
}

.apnb-form-group {
    margin-bottom: 15px;
}

.apnb-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.apnb-field-description {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
    margin-bottom: 0;
}

.apnb-char-counter {
    font-size: 0.8em;
    color: #888;
    text-align: right;
    margin-top: 2px;
}

.apnb-form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    height: 42px; /* Uniform height for text and date inputs */
}

.apnb-form-row {
    display: flex;
    gap: 15px;
}
.apnb-form-row .apnb-form-group {
    flex: 1;
}

.apnb-btn {
    background: #2271b1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}
.apnb-btn:hover {
    background: #135e96;
}

.apnb-alert { padding: 10px; margin-bottom: 15px; border-radius: 4px; }
.apnb-alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.apnb-alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.apnb-alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* Mobile Responsive Ticker */
@media (max-width: 768px) {
    .apnb-ticker-wrap {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Solleva il ticker dal fondo su mobile se posizionato in basso */
    .apnb-position-bottom .apnb-banner {
        padding-bottom: 30px !important; 
    }

    .apnb-ticker-prefix {
        width: 100%;
        justify-content: center;
        padding: 5px 10px;
        font-size: 0.9em; /* Slightly smaller font for prefix on mobile */
    }

    .apnb-ticker-content-wrap {
        width: 100%;
        font-size: 0.9em; /* Slightly smaller font for content on mobile */
    }
}