/**
 * RSUD Accessibility Widget - Fixed CSS
 */

/* Reset dan Base Styles */
.rsud_acc_widget * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Widget Container */
.rsud_acc_widget {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: #fff;
    border: 2px solid #2c5aa0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-family: Arial, sans-serif;
    min-width: 50px;
    transition: all 0.3s ease;
}

.rsud_acc_widget.minimized {
    min-width: 50px;
    width: 50px;
    height: 50px;
    overflow: hidden;
}

.rsud_acc_widget.expanded {
    min-width: 280px;
    width: auto;
    height: auto;
    overflow: visible;
}

/* Toggle Button */
.rsud_acc_toggle {
    width: 50px;
    height: 50px;
    background: #2c5aa0;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: absolute;
    top: -2px;
    right: -2px;
}

.rsud_acc_toggle:hover {
    background: #1e3d6f;
    transform: scale(1.05);
}

/* Panel Content */
.rsud_acc_panel {
    padding: 15px;
    padding-top: 60px;
    display: none;
}

.rsud_acc_widget.expanded .rsud_acc_panel {
    display: block;
}

/* Group Styling */
.rsud_acc_group {
    margin-bottom: 15px;
}

.rsud_acc_title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #2c5aa0;
    font-size: 14px;
}

/* Button Styles */
.rsud_acc_button {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 2px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: inline-block;
    text-align: center;
}

.rsud_acc_button:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.rsud_acc_button.active {
    background: #2c5aa0;
    color: white;
    border-color: #2c5aa0;
}

/* Speech Controls */
.rsud_acc_speech_controls {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.rsud_acc_speak_btn, .rsud_acc_stop_btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rsud_acc_speak_btn {
    background: #28a745;
    color: white;
    border: 1px solid #218838;
}

.rsud_acc_stop_btn {
    background: #dc3545;
    color: white;
    border: 1px solid #c82333;
}

.rsud_acc_speak_btn:hover {
    background: #218838;
}

.rsud_acc_stop_btn:hover {
    background: #c82333;
}

/* Text Size Settings - FIXED */
body .rsud_acc_widget {
    font-size: 14px !important;
}

body.rsud_acc_large_text .rsud_acc_widget {
    font-size: 16px !important;
    min-width: 300px !important;
}

body.rsud_acc_large_text .rsud_acc_button {
    padding: 10px 14px !important;
    font-size: 14px !important;
    margin: 3px !important;
}

body.rsud_acc_large_text .rsud_acc_panel {
    padding: 18px !important;
    padding-top: 65px !important;
}

body.rsud_acc_xlarge_text .rsud_acc_widget {
    font-size: 18px !important;
    min-width: 350px !important;
    border-width: 3px !important;
}

body.rsud_acc_xlarge_text .rsud_acc_button {
    padding: 12px 16px !important;
    font-size: 16px !important;
    margin: 4px !important;
}

body.rsud_acc_xlarge_text .rsud_acc_panel {
    padding: 20px !important;
    padding-top: 70px !important;
}

body.rsud_acc_xlarge_text .rsud_acc_title {
    font-size: 16px !important;
    margin-bottom: 12px !important;
}

body.rsud_acc_xlarge_text .rsud_acc_group {
    margin-bottom: 20px !important;
}

/* High Contrast Mode */
body.rsud_acc_high_contrast .rsud_acc_widget {
    border: 3px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
}

body.rsud_acc_high_contrast .rsud_acc_button {
    border: 2px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
}

body.rsud_acc_high_contrast .rsud_acc_button.active {
    background: #000000 !important;
    color: #ffffff !important;
}

body.rsud_acc_high_contrast .rsud_acc_toggle {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #000000 !important;
}

/* Underline Links */
body.rsud_acc_underline_links a:not(.rsud_acc_button) {
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
}

/* Readable Font */
body.rsud_acc_readable_font {
    font-family: Arial, Helvetica, sans-serif !important;
}

body.rsud_acc_readable_font .rsud_acc_widget {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Speech Animation */
.rsud_acc_speaking {
    animation: rsud_acc_pulse 1.5s infinite;
}

@keyframes rsud_acc_pulse {
    0% { 
        box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 0 0 rgba(40, 167, 69, 0.7); 
    }
    70% { 
        box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 0 10px rgba(40, 167, 69, 0); 
    }
    100% { 
        box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 0 0 rgba(40, 167, 69, 0); 
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .rsud_acc_widget {
        top: 10px;
        right: 10px;
        min-width: 45px;
    }
    
    .rsud_acc_widget.minimized {
        width: 45px;
        height: 45px;
    }
    
    .rsud_acc_toggle {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .rsud_acc_widget.expanded {
        min-width: 260px;
        max-width: calc(100vw - 20px);
    }
    
    .rsud_acc_panel {
        padding-top: 55px;
    }
    
    body.rsud_acc_large_text .rsud_acc_widget {
        min-width: 280px !important;
    }
    
    body.rsud_acc_xlarge_text .rsud_acc_widget {
        min-width: 300px !important;
    }
}