/**
 * Cookie Consent Banner Styles
 *
 * @package Cookie_Consent_Manager
 */

/* Banner Container */
.ccm-banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 999999;
    padding: 20px;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
    animation: ccm-slide-in 0.3s ease-out;
    overflow-x: hidden;
}

.ccm-banner.ccm-position-bottom {
    bottom: 0;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.15);
}

.ccm-banner.ccm-position-top {
    top: 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

.ccm-banner.ccm-position-center {
    top: 50%;
    transform: translateY(-50%);
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

/* Center position: vertical layout with buttons below text */
.ccm-banner.ccm-position-center .ccm-banner-simple {
    flex-direction: column;
    align-items: stretch;
}

.ccm-banner.ccm-position-center .ccm-banner-text {
    margin-bottom: 20px;
}

/* Center position: 2x2 grid layout for buttons */
.ccm-banner.ccm-position-center .ccm-banner-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ccm-banner.ccm-position-center .ccm-banner-button {
    white-space: normal;
    text-align: center;
}

/* Grid positioning: Row 1 - Accept All, Cookie Settings */
.ccm-banner.ccm-position-center #ccm-accept-all {
    grid-row: 1;
    grid-column: 1;
}

.ccm-banner.ccm-position-center #ccm-show-settings {
    grid-row: 1;
    grid-column: 2;
}

/* Grid positioning: Row 2 - Only Necessary, Privacy Policy */
.ccm-banner.ccm-position-center #ccm-reject-all {
    grid-row: 2;
    grid-column: 1;
}

.ccm-banner.ccm-position-center .ccm-banner-privacy-link-simple {
    grid-row: 2;
    grid-column: 2;
}

/* Animation */
@keyframes ccm-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Banner Content */
.ccm-banner-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.ccm-banner-simple {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

@media (max-width: 768px) {
    .ccm-banner-simple {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Banner Text */
.ccm-banner-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.ccm-banner-message {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Banner Actions */
.ccm-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .ccm-banner-actions {
        flex-direction: column;
        width: 100%;
    }
}

/* Buttons */
.ccm-banner-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ccm-banner-button-primary {
    /* Colors set via inline styles from PHP */
}

.ccm-banner-button-secondary {
    background-color: transparent;
    border: 2px solid currentColor;
    color: inherit;
}

.ccm-banner-button-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.ccm-banner-button-link {
    background-color: transparent;
    color: inherit;
    text-decoration: underline;
    padding: 10px;
}

.ccm-banner-button-link:hover {
    opacity: 0.8;
}

/* Detailed View */
.ccm-banner-detailed {
    position: relative;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* For center position, ensure it doesn't overflow viewport */
.ccm-banner.ccm-position-center .ccm-banner-detailed {
    max-height: 80vh;
}

/* Dismiss button (subtle, in simple view) */
.ccm-banner-dismiss {
    position: absolute;
    top: 28px;
    right: 28px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.3;
    padding: 4px 8px;
    transition: opacity 0.2s;
    z-index: 10;
}

.ccm-banner-dismiss:hover {
    opacity: 0.6;
}

/* Close button (in detailed view) */
.ccm-banner-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.ccm-banner-close:hover {
    opacity: 1;
}

/* Consent status message */
.ccm-consent-status {
    display: inline-flex;
    align-items: center;
}

.ccm-status-message {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}

.ccm-banner-title-detailed {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Categories List */
.ccm-categories-list {
    margin: 15px 0;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.ccm-category-item {
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin-bottom: 6px;
    background-color: rgba(255, 255, 255, 0.5);
}

.ccm-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.ccm-category-info {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.ccm-category-name {
    font-weight: 600;
    font-size: 15px;
    margin: 0 0 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ccm-category-description {
    font-size: 12px;
    margin: 0;
    opacity: 0.8;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Toggle Switch */
.ccm-category-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    flex-shrink: 0;
}

.ccm-category-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ccm-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2);
    transition: 0.3s;
    border-radius: 24px;
}

.ccm-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: 0.3s;
    border-radius: 50%;
}

.ccm-category-toggle input:checked + .ccm-toggle-slider:before {
    transform: translateX(26px);
}

.ccm-category-toggle input:disabled + .ccm-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.ccm-category-required {
    font-size: 12px;
    opacity: 0.7;
    font-style: italic;
}

/* Banner Footer - contains actions and right-side elements */
.ccm-banner-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-shrink: 0;
    gap: 20px;
}

/* Detailed Actions */
.ccm-banner-actions-detailed {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Footer Right Side - contains withdraw and privacy link */
.ccm-banner-footer-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Center position: vertical layout for detailed footer */
.ccm-banner.ccm-position-center .ccm-banner-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
}

.ccm-banner.ccm-position-center .ccm-banner-actions-detailed {
    justify-content: center;
}

.ccm-banner.ccm-position-center .ccm-banner-footer-right {
    justify-content: center;
    flex-direction: row;
}

.ccm-privacy-link {
    font-size: 13px;
    white-space: nowrap;
}

.ccm-privacy-link a {
    color: inherit;
    text-decoration: underline;
}

/* Mobile: stack footer elements and adjust layout */
@media (max-width: 768px) {
    .ccm-banner {
        padding: 15px;
    }

    .ccm-banner-dismiss {
        top: 23px;
        right: 23px;
    }

    .ccm-banner-content {
        max-width: 100%;
        overflow-x: hidden;
    }

    .ccm-banner-detailed {
        padding: 15px;
        max-height: 95vh;
        overflow-x: hidden;
        width: 100%;
    }

    .ccm-banner-title-detailed {
        font-size: 16px;
        margin: 0 0 10px 0;
    }

    .ccm-categories-list {
        margin: 10px 0;
        width: 100%;
        overflow-x: hidden;
    }

    .ccm-category-item {
        padding: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .ccm-category-header {
        gap: 10px;
        align-items: flex-start;
        width: 100%;
    }

    .ccm-category-info {
        overflow: hidden;
        max-width: calc(100% - 60px);
    }

    .ccm-category-name {
        font-size: 14px;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .ccm-category-description {
        font-size: 11px;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .ccm-category-toggle {
        margin-top: 2px;
        flex-shrink: 0;
    }

    .ccm-banner-footer {
        flex-direction: column;
        align-items: stretch;
        margin-top: 15px;
        width: 100%;
    }

    .ccm-banner-actions-detailed {
        flex-direction: column;
        width: 100%;
    }

    .ccm-banner-actions-detailed .ccm-banner-button {
        width: 100%;
        box-sizing: border-box;
    }

    .ccm-banner-footer-right {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }

    .ccm-privacy-link {
        white-space: normal;
        word-wrap: break-word;
    }
}

/* Overlay */
.ccm-banner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999998;
}

/* Settings Trigger Button */
.ccm-settings-trigger {
    padding: 10px 20px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.ccm-settings-trigger:hover {
    background-color: #005a87;
}

/* Floating Cookie Settings Button */
.ccm-floating-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999997;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ccm-floating-button svg {
    width: 28px;
    height: 28px;
}

.ccm-floating-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ccm-floating-button:active {
    transform: scale(0.95);
}

/* Hide floating button when banner is visible */
.ccm-banner[style*="display: block"] ~ .ccm-floating-button,
.ccm-banner[style*="display: flex"] ~ .ccm-floating-button {
    display: none !important;
}

/* Mobile positioning */
@media (max-width: 768px) {
    .ccm-floating-button {
        bottom: 15px;
        left: 15px;
        width: 50px;
        height: 50px;
    }

    .ccm-floating-button svg {
        width: 24px;
        height: 24px;
    }
}


/* Cookie count */
.ccm-category-cookie-count {
    margin: 5px 0 0 0;
    font-size: 12px;
    opacity: 0.7;
    font-style: italic;
}
