/**
 * Kiyoh Widget Frontend Styles
 */

/* Standard Widget Container */
.kiyoh-widget-container {
    display: block;
    max-width: 100%;
    margin: 20px 0;
}

.kiyoh-widget-container iframe {
    max-width: 100%;
    display: block;
}

/* Alignment */
.kiyoh-align-left {
    text-align: left;
}

.kiyoh-align-center {
    text-align: center;
}

.kiyoh-align-right {
    text-align: right;
}

.kiyoh-align-center iframe,
.kiyoh-align-left iframe,
.kiyoh-align-right iframe {
    display: inline-block;
}

/* Header/Footer widgets */
.kiyoh-widget-header {
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
}

.kiyoh-widget-footer {
    padding: 15px;
    background: rgba(255, 255, 255, 0.95);
}

/* Sidebar widget */
.kiyoh-sidebar-widget iframe {
    width: 100% !important;
    max-width: 100%;
}

/* ==========================================
   STICKY WIDGET - BASE
   ========================================== */

.kiyoh-sticky-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Horizontal Position */
.kiyoh-sticky-left {
    left: 0;
}

.kiyoh-sticky-right {
    right: 0;
}

/* Vertical Position */
.kiyoh-sticky-v-top {
    top: 100px;
}

.kiyoh-sticky-v-middle {
    top: 50%;
    transform: translateY(-50%);
}

.kiyoh-sticky-v-bottom {
    bottom: 100px;
}

/* ==========================================
   EXPANDABLE MODE - TAB
   ========================================== */

.kiyoh-sticky-tab {
    cursor: pointer;
    padding: 15px 10px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kiyoh-sticky-left .kiyoh-sticky-tab {
    border-radius: 0 12px 12px 0;
}

.kiyoh-sticky-right .kiyoh-sticky-tab {
    border-radius: 12px 0 0 12px;
}

.kiyoh-sticky-tab:hover {
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.5);
}

.kiyoh-sticky-tab:focus {
    outline: 2px solid #fff;
    outline-offset: -4px;
}

.kiyoh-sticky-tab-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.kiyoh-sticky-tab-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.kiyoh-sticky-tab-text {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Hide tab when panel is open */
.kiyoh-sticky-widget.is-open .kiyoh-sticky-tab {
    display: none;
}

/* ==========================================
   EXPANDABLE MODE - PANEL
   ========================================== */

.kiyoh-sticky-panel {
    display: none;
    position: absolute;
    top: 0;
    padding: 20px;
    padding-top: 45px;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffc857 0%, #ffb830 100%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.kiyoh-sticky-widget.is-open .kiyoh-sticky-panel {
    display: block;
    animation: kiyohSlideIn 0.3s ease;
}

/* Panel positioning */
.kiyoh-sticky-left .kiyoh-sticky-panel {
    left: 10px;
}

.kiyoh-sticky-right .kiyoh-sticky-panel {
    right: 10px;
}

/* Panel content */
.kiyoh-sticky-panel-content {
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kiyoh-sticky-panel-content iframe {
    display: block;
}

/* ==========================================
   BADGE MODE (Always Visible)
   ========================================== */

.kiyoh-sticky-badge-mode .kiyoh-sticky-badge {
    padding: 20px;
    padding-top: 45px;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffc857 0%, #ffb830 100%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    animation: kiyohSlideIn 0.5s ease;
}

.kiyoh-sticky-left .kiyoh-sticky-badge {
    border-radius: 0 16px 16px 0;
}

.kiyoh-sticky-right .kiyoh-sticky-badge {
    border-radius: 16px 0 0 16px;
}

.kiyoh-sticky-badge-content {
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.kiyoh-sticky-badge-content iframe {
    display: block;
}

/* Hide badge when dismissed */
.kiyoh-sticky-badge-mode.is-hidden .kiyoh-sticky-badge {
    display: none;
}

/* ==========================================
   CLOSE BUTTON
   ========================================== */

.kiyoh-sticky-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(0, 0, 0, 0.15);
    color: #333;
    font-size: 22px;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kiyoh-sticky-close:hover {
    background: rgba(0, 0, 0, 0.25);
}

.kiyoh-sticky-close:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* ==========================================
   PANEL STYLES
   ========================================== */

/* Glass/Frosted Effect */
.kiyoh-sticky-style-glass .kiyoh-sticky-panel,
.kiyoh-sticky-style-glass .kiyoh-sticky-badge {
    background: linear-gradient(145deg, rgba(255, 200, 87, 0.95) 0%, rgba(255, 184, 48, 0.9) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.kiyoh-sticky-style-glass .kiyoh-sticky-close {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.kiyoh-sticky-style-glass .kiyoh-sticky-close:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* Solid Style */
.kiyoh-sticky-style-solid .kiyoh-sticky-panel,
.kiyoh-sticky-style-solid .kiyoh-sticky-badge {
    background: #ffc857;
    border: none;
}

/* Shadow Style */
.kiyoh-sticky-style-shadow .kiyoh-sticky-panel,
.kiyoh-sticky-style-shadow .kiyoh-sticky-badge {
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.kiyoh-sticky-style-shadow .kiyoh-sticky-close {
    background: rgba(0, 0, 0, 0.08);
}

/* ==========================================
   ANIMATIONS
   ========================================== */

@keyframes kiyohSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateX(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

.kiyoh-sticky-left .kiyoh-sticky-panel,
.kiyoh-sticky-left .kiyoh-sticky-badge {
    animation-name: kiyohSlideInLeft;
}

@keyframes kiyohSlideInLeft {
    from {
        opacity: 0;
        transform: scale(0.9) translateX(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */

@media screen and (max-width: 768px) {
    .kiyoh-sticky-widget {
        bottom: 20px !important;
        top: auto !important;
        transform: none !important;
    }

    .kiyoh-sticky-v-middle {
        transform: none;
    }

    .kiyoh-sticky-left {
        left: 0;
    }

    .kiyoh-sticky-right {
        right: 0;
    }

    /* Horizontal tab on mobile */
    .kiyoh-sticky-tab {
        padding: 12px 18px;
    }

    .kiyoh-sticky-tab-inner {
        writing-mode: horizontal-tb;
        flex-direction: row;
        gap: 10px;
    }

    .kiyoh-sticky-left .kiyoh-sticky-tab {
        border-radius: 0 20px 20px 0;
    }

    .kiyoh-sticky-right .kiyoh-sticky-tab {
        border-radius: 20px 0 0 20px;
    }

    /* Full-width panel on mobile */
    .kiyoh-sticky-panel,
    .kiyoh-sticky-badge {
        position: fixed;
        top: auto !important;
        bottom: 80px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto;
        border-radius: 16px !important;
    }

    .kiyoh-sticky-panel-content iframe,
    .kiyoh-sticky-badge-content iframe {
        width: 100% !important;
        max-width: 100%;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .kiyoh-sticky-widget {
        display: none !important;
    }
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    .kiyoh-sticky-widget.is-open .kiyoh-sticky-panel,
    .kiyoh-sticky-badge-mode .kiyoh-sticky-badge {
        animation: none;
    }

    .kiyoh-sticky-tab,
    .kiyoh-sticky-close {
        transition: none;
    }
}
