/**
 * Frontend CSS for ALA Cookie Consent
 *
 * @package AlaCookieConsent
 */

/* Reset and base styles */
#ala-cookie-consent * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Main banner styles */
#ala-cookie-consent {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease-in-out;
}

/* Position variants */
.ala-cc-top {
    top: 0;
    left: 0;
    right: 0;
}

.ala-cc-bottom {
    bottom: 0;
    left: 0;
    right: 0;
}

.ala-cc-top-left {
    top: 20px;
    left: 20px;
    max-width: 400px;
}

.ala-cc-top-right {
    top: 20px;
    right: 20px;
    max-width: 400px;
}

.ala-cc-bottom-left {
    bottom: 20px;
    left: 20px;
    max-width: 400px;
}

.ala-cc-bottom-right {
    bottom: 20px;
    right: 20px;
    max-width: 400px;
}

/* Layout variants */
.ala-cc-bar {
    padding: 15px 20px;
}

.ala-cc-box {
    padding: 20px;
    border-radius: 8px;
    margin: 20px;
}

.ala-cc-popup {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%);
    max-width: 500px;
    width: 90%;
    padding: 25px;
    border-radius: 12px;
}

/* Container and content */
.ala-cc-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ala-cc-content {
    flex: 1;
    min-width: 300px;
}

.ala-cc-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    line-height: 1.3;
}

.ala-cc-message {
    margin-bottom: 15px;
    font-weight: 400;
    line-height: 1.6;
    /* Better readability for multi-line messages */
}

.ala-cc-message p {
    margin: 0 0 10px 0;
}

.ala-cc-message p:last-child {
    margin-bottom: 0;
}

/* Buttons container */
.ala-cc-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Button styles */
.ala-cc-btn {
    display: inline-block;
    padding: 10px 20px !important;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
    min-height: 40px;
    min-width: 120px;
    line-height: 1.2;
}

.ala-cc-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ala-cc-btn:active {
    transform: translateY(0);
}

.ala-cc-btn:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Accept button */
.ala-cc-accept {
    background-color: #4CAF50;
    color: #ffffff;
}

.ala-cc-accept:hover {
    background-color: #45a049;
}

/* Decline button */
.ala-cc-decline {
    background-color: #f44336;
    color: #ffffff;
}

.ala-cc-decline:hover {
    background-color: #da190b;
}

/* Settings button */
.ala-cc-settings {
    background-color: transparent;
    color: inherit;
    border: 1px solid currentColor;
}

.ala-cc-settings:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Link styles */
.ala-cc-link {
    color: inherit;
    text-decoration: underline;
    padding: 10px;
    display: inline-block;
    transition: opacity 0.2s ease;
}

.ala-cc-link:hover {
    opacity: 0.8;
    text-decoration: none;
}

.ala-cc-link:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Animation classes */
.ala-cc-animate-top {
    animation: slideInFromTop 0.5s ease-out;
}

.ala-cc-animate-bottom {
    animation: slideInFromBottom 0.5s ease-out;
}

.ala-cc-animate-top-left,
.ala-cc-animate-top-right,
.ala-cc-animate-bottom-left,
.ala-cc-animate-bottom-right {
    animation: slideInFromCorner 0.5s ease-out;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromCorner {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Body class when banner is visible */
body.ala-cc-banner-visible.ala-cc-top {
    padding-top: 80px;
}

body.ala-cc-banner-visible.ala-cc-bottom {
    padding-bottom: 80px;
}

/* Responsive design */
@media (max-width: 768px) {
    #ala-cookie-consent {
        font-size: 13px;
    }

    .ala-cc-container {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .ala-cc-content {
        min-width: auto;
    }

    .ala-cc-message {
        margin-bottom: 10px;
    }

    .ala-cc-buttons {
        justify-content: center;
        width: 100%;
    }

    .ala-cc-btn {
        padding: 8px 16px;
        font-size: 13px;
        min-height: 36px;
    }

    /* Adjust corner positions for mobile */
    .ala-cc-top-left,
    .ala-cc-top-right,
    .ala-cc-bottom-left,
    .ala-cc-bottom-right {
        max-width: calc(100% - 20px);
        left: 10px !important;
        right: 10px !important;
    }

    .ala-cc-top-left,
    .ala-cc-top-right {
        top: 10px !important;
    }

    .ala-cc-bottom-left,
    .ala-cc-bottom-right {
        bottom: 10px !important;
    }

    /* Popup adjustments */
    .ala-cc-popup {
        width: 95%;
        padding: 20px;
        max-width: none;
    }

    /* Reduce body padding on mobile */
    body.ala-cc-banner-visible.ala-cc-top {
        padding-top: 60px;
    }

    body.ala-cc-banner-visible.ala-cc-bottom {
        padding-bottom: 60px;
    }
}

@media (max-width: 480px) {
    .ala-cc-buttons {
        flex-direction: column;
        width: 100%;
    }

    .ala-cc-btn {
        width: 100%;
        text-align: center;
    }

    .ala-cc-link {
        width: 100%;
        text-align: center;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #ala-cookie-consent {
        border: 2px solid;
    }

    .ala-cc-btn {
        border: 2px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    #ala-cookie-consent,
    .ala-cc-btn {
        transition: none;
    }

    .ala-cc-animate-top,
    .ala-cc-animate-bottom,
    .ala-cc-animate-top-left,
    .ala-cc-animate-top-right,
    .ala-cc-animate-bottom-left,
    .ala-cc-animate-bottom-right {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #ala-cookie-consent {
        background-color: #1a1a1a;
        color: #ffffff;
    }

    .ala-cc-settings:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* Print styles */
@media print {
    #ala-cookie-consent {
        display: none !important;
    }
}

/* Focus styles for accessibility */
.ala-cc-btn:focus-visible,
.ala-cc-link:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Custom scrollbar for long messages */
.ala-cc-message::-webkit-scrollbar {
    width: 6px;
}

.ala-cc-message::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.ala-cc-message::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.ala-cc-message::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Loading state */
.ala-cc-loading .ala-cc-btn {
    opacity: 0.6;
    pointer-events: none;
}

.ala-cc-loading .ala-cc-btn::after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid currentColor;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* RTL support */
[dir="rtl"] .ala-cc-buttons {
    direction: rtl;
}

[dir="rtl"] .ala-cc-container {
    direction: rtl;
}

/* Custom properties for easy theming */
:root {
    --ala-cc-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    --ala-cc-border-radius: 5px;
    --ala-cc-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --ala-cc-transition: all 0.3s ease-in-out;
}

/* IE11 fallbacks */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .ala-cc-container {
        display: block;
    }

    .ala-cc-buttons {
        display: block;
        margin-top: 15px;
    }

    .ala-cc-btn {
        display: inline-block;
        margin-right: 10px;
        margin-bottom: 5px;
    }
}

/* Safari-specific fixes */
@supports (-webkit-appearance: none) {
    .ala-cc-btn {
        -webkit-appearance: none;
        appearance: none;
    }
}