/* Frontend Styles */
.cdm-toggle-wrapper {
    display: inline-block;
}

/* Switch Style */
.cdm-toggle-switch {
    position: relative;
    display: inline-block;
    width: 2.5em; /* relative to font-size */
    height: 1.4em;
}

.cdm-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cdm-toggle-switch .cdm-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.3em;
    overflow: hidden;
}

.cdm-toggle-switch .cdm-slider:before {
    position: absolute;
    content: "";
    height: 1em;
    width: 1em;
    left: 0.2em;
    bottom: 0.2em;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}

.cdm-toggle-switch input:checked + .cdm-slider {
    background-color: #2196F3; /* Default, overridden by widget */
}

.cdm-toggle-switch input:checked + .cdm-slider:before {
    transform: translateX(1.1em);
}

.cdm-toggle-switch .cdm-icon-light,
.cdm-toggle-switch .cdm-icon-dark {
    font-size: 0.7em;
    z-index: 1;
    position: relative;
    line-height: 1;
}

.cdm-toggle-switch .cdm-icon-light {
    color: #f1c40f;
}

.cdm-toggle-switch .cdm-icon-dark {
    color: #f1c40f;
}

/* Button Style */
.cdm-toggle-btn {
    background: #eee;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    transition: background 0.3s;
}

.cdm-toggle-btn.active {
    background: #333;
    color: #fff;
}

.cdm-toggle-btn .cdm-icon-dark,
.cdm-toggle-btn .cdm-label-dark {
    display: none;
}

.cdm-toggle-btn.active .cdm-icon-light,
.cdm-toggle-btn.active .cdm-label-light {
    display: none;
}

.cdm-toggle-btn.active .cdm-icon-dark,
.cdm-toggle-btn.active .cdm-label-dark {
    display: inline-block;
}

/* Dark Mode Base Styles */
body.cdm-dark-mode {
    /* Variables are handled by the engine */
}
