/* Cookie Banner */
#mg-cookie-banner {
    position: fixed;
    z-index: 9999;
    width: 100%;
    padding: 24px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
}

/* ========================================
   DESIGN TEMPLATES
======================================== */

/* Modern Template (Default + Blue Gradient) */
#mg-cookie-banner.mg-template-modern {
    background: linear-gradient(135deg, #4A90E2 0%, #667EEA 100%);
}

#mg-cookie-banner.mg-template-modern .mg-banner-title {
    color: #ffffff;
}

#mg-cookie-banner.mg-template-modern .mg-banner-text {
    color: rgba(255, 255, 255, 0.95);
}

#mg-cookie-banner.mg-template-modern .mg-privacy-link {
    color: #ffffff;
    text-decoration: underline;
}

#mg-cookie-banner.mg-template-modern .mg-btn-accept {
    background: #ffffff;
    color: #4A90E2;
}

#mg-cookie-banner.mg-template-modern .mg-btn-accept:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

#mg-cookie-banner.mg-template-modern .mg-btn-settings {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#mg-cookie-banner.mg-template-modern .mg-btn-settings:hover {
    background: rgba(255, 255, 255, 0.3);
}

#mg-cookie-banner.mg-template-modern .mg-btn-decline {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#mg-cookie-banner.mg-template-modern .mg-btn-decline:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Minimal Template (Black/White) */
#mg-cookie-banner.mg-template-minimal {
    background: #ffffff;
    border-top: 3px solid #000000;
}

#mg-cookie-banner.mg-template-minimal .mg-banner-title {
    color: #000000;
}

#mg-cookie-banner.mg-template-minimal .mg-banner-text {
    color: #333333;
}

#mg-cookie-banner.mg-template-minimal .mg-privacy-link {
    color: #000000;
}

#mg-cookie-banner.mg-template-minimal .mg-btn-accept {
    background: #000000;
    color: #ffffff;
}

#mg-cookie-banner.mg-template-minimal .mg-btn-accept:hover {
    background: #333333;
}

#mg-cookie-banner.mg-template-minimal .mg-btn-settings {
    background: #f5f5f5;
    color: #000000;
    border: 1px solid #e0e0e0;
}

#mg-cookie-banner.mg-template-minimal .mg-btn-settings:hover {
    background: #e8e8e8;
}

#mg-cookie-banner.mg-template-minimal .mg-btn-decline {
    background: transparent;
    color: #666666;
    border: 1px solid #e0e0e0;
}

#mg-cookie-banner.mg-template-minimal .mg-btn-decline:hover {
    background: #f9f9f9;
}

/* Classic Template (Traditional Gray) */
#mg-cookie-banner.mg-template-classic {
    background: #f5f5f5;
    border-top: 1px solid #ddd;
}

#mg-cookie-banner.mg-template-classic .mg-banner-title {
    color: #333333;
}

#mg-cookie-banner.mg-template-classic .mg-banner-text {
    color: #666666;
}

#mg-cookie-banner.mg-template-classic .mg-privacy-link {
    color: #0066cc;
}

#mg-cookie-banner.mg-template-classic .mg-btn-accept {
    background: #5cb85c;
    color: #ffffff;
    border: none;
}

#mg-cookie-banner.mg-template-classic .mg-btn-accept:hover {
    background: #449d44;
}

#mg-cookie-banner.mg-template-classic .mg-btn-settings {
    background: #0275d8;
    color: #ffffff;
    border: none;
}

#mg-cookie-banner.mg-template-classic .mg-btn-settings:hover {
    background: #025aa5;
}

#mg-cookie-banner.mg-template-classic .mg-btn-decline {
    background: #d9534f;
    color: #ffffff;
    border: none;
}

#mg-cookie-banner.mg-template-classic .mg-btn-decline:hover {
    background: #c9302c;
}

/* Dark Template (Dark Mode) */
#mg-cookie-banner.mg-template-dark {
    background: linear-gradient(135deg, #1A1A2E 0%, #2D2D44 100%);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.5);
}

#mg-cookie-banner.mg-template-dark .mg-banner-title {
    color: #ffffff;
}

#mg-cookie-banner.mg-template-dark .mg-banner-text {
    color: rgba(255, 255, 255, 0.85);
}

#mg-cookie-banner.mg-template-dark .mg-privacy-link {
    color: #6C63FF;
}

#mg-cookie-banner.mg-template-dark .mg-btn-accept {
    background: #6C63FF;
    color: #ffffff;
}

#mg-cookie-banner.mg-template-dark .mg-btn-accept:hover {
    background: #5548d9;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

#mg-cookie-banner.mg-template-dark .mg-btn-settings {
    background: rgba(108, 99, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(108, 99, 255, 0.3);
}

#mg-cookie-banner.mg-template-dark .mg-btn-settings:hover {
    background: rgba(108, 99, 255, 0.3);
}

#mg-cookie-banner.mg-template-dark .mg-btn-decline {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#mg-cookie-banner.mg-template-dark .mg-btn-decline:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Colorful Template (Rainbow Gradient) */
#mg-cookie-banner.mg-template-colorful {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

#mg-cookie-banner.mg-template-colorful .mg-banner-title {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#mg-cookie-banner.mg-template-colorful .mg-banner-text {
    color: rgba(255, 255, 255, 0.95);
}

#mg-cookie-banner.mg-template-colorful .mg-privacy-link {
    color: #ffffff;
    text-decoration: underline;
}

#mg-cookie-banner.mg-template-colorful .mg-btn-accept {
    background: #ffffff;
    color: #764ba2;
    font-weight: 600;
}

#mg-cookie-banner.mg-template-colorful .mg-btn-accept:hover {
    background: #f0f0f0;
    transform: translateY(-2px) scale(1.05);
}

#mg-cookie-banner.mg-template-colorful .mg-btn-settings {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
}

#mg-cookie-banner.mg-template-colorful .mg-btn-settings:hover {
    background: rgba(255, 255, 255, 0.35);
}

#mg-cookie-banner.mg-template-colorful .mg-btn-decline {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

#mg-cookie-banner.mg-template-colorful .mg-btn-decline:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Custom Template (User-defined Colors) */
#mg-cookie-banner.mg-template-custom .mg-banner-title {
    color: inherit;
}

#mg-cookie-banner.mg-template-custom .mg-banner-text {
    color: inherit;
    opacity: 0.85;
}

#mg-cookie-banner.mg-template-custom .mg-privacy-link {
    color: inherit;
    font-weight: 600;
}

#mg-cookie-banner.mg-template-custom .mg-btn-accept {
    background: var(--mg-btn-color, #1a73e8);
    color: #ffffff;
}

#mg-cookie-banner.mg-template-custom .mg-btn-accept:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
}

#mg-cookie-banner.mg-template-custom .mg-btn-settings {
    background: rgba(0, 0, 0, 0.05);
    color: inherit;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#mg-cookie-banner.mg-template-custom .mg-btn-settings:hover {
    background: rgba(0, 0, 0, 0.1);
}

#mg-cookie-banner.mg-template-custom .mg-btn-decline {
    background: transparent;
    color: inherit;
    opacity: 0.7;
    border: 1px solid currentColor;
}

#mg-cookie-banner.mg-template-custom .mg-btn-decline:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

/* ========================================
   END DESIGN TEMPLATES
======================================== */

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Fade Out Animation */
#mg-cookie-banner.mg-fade-out {
    animation: fadeOut 0.4s ease-out forwards;
}

@keyframes fadeOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
}

/* Floating Cookie Settings Button */
#mg-floating-settings {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: floatIn 0.5s ease-out;
}

#mg-floating-settings:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

#mg-floating-settings:active {
    transform: translateY(-2px) scale(1.05);
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(100px) scale(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Pulsing effect */
#mg-floating-settings::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #667eea;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    #mg-floating-settings {
        width: 48px;
        height: 48px;
        font-size: 20px;
        bottom: 16px;
        left: 16px;
    }
}

#mg-cookie-banner.mg-position-footer {
    bottom: 0;
    left: 0;
}

#mg-cookie-banner.mg-position-header {
    top: 0;
    left: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

#mg-cookie-banner.mg-position-center,
#mg-cookie-banner.mg-position-popup {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 580px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.mg-banner-content {
    max-width: 1200px;
    margin: 0 auto;
}

.mg-banner-header {
    margin-bottom: 12px;
}

.mg-banner-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
}

.mg-banner-text {
    margin: 0 0 20px 0;
    color: #4a4a4a;
    font-size: 14px;
    line-height: 1.6;
}

.mg-privacy-link {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
}

.mg-privacy-link:hover {
    text-decoration: underline;
}

.mg-banner-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}

@media (max-width: 768px) {
    .mg-banner-buttons {
        flex-direction: column;
        gap: 10px;
    }
}

.mg-btn {
    padding: 11px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.mg-btn-accept {
    background: #1a73e8;
    color: #fff;
}

.mg-btn-accept:hover {
    background: #1557b0;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.mg-btn-settings {
    background: #f1f3f4;
    color: #1a1a1a;
    border: 1px solid #dadce0;
}

.mg-btn-settings:hover {
    background: #e8eaed;
}

.mg-btn-decline {
    background: transparent;
    color: #5f6368;
    border: 1px solid #dadce0;
}

.mg-btn-decline:hover {
    background: #f8f9fa;
}

@media (max-width: 768px) {
    .mg-btn {
        width: 100%;
    }
}

/* Modal */
.mg-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mg-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: overlayFadeIn 0.3s ease;
}

@keyframes overlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mg-modal-content {
    position: relative;
    background: #fff;
    max-width: 680px;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Modal closing animation */
.mg-modal.mg-modal-closing .mg-modal-overlay {
    animation: overlayFadeOut 0.3s ease forwards;
}

.mg-modal.mg-modal-closing .mg-modal-content {
    animation: modalSlideOut 0.3s ease forwards;
}

@keyframes overlayFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalSlideOut {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }
}

.mg-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mg-modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
}

.mg-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #5f6368;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.mg-modal-close:hover {
    background: #f1f3f4;
}

.mg-modal-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 24px;
    gap: 8px;
}

.mg-tab-btn {
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
}

.mg-tab-btn:hover {
    color: #1a73e8;
}

.mg-tab-btn.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
}

.mg-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.mg-tab-content {
    display: none;
}

.mg-tab-content.active {
    display: block;
}

.mg-tab-description {
    color: #4a4a4a;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 24px;
}

.mg-cookie-categories {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mg-cookie-category {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    transition: border-color 0.2s;
}

.mg-cookie-category:hover {
    border-color: #1a73e8;
}

.mg-category-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.mg-category-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #1a1a1a;
}

.mg-category-info p {
    font-size: 13px;
    color: #5f6368;
    margin: 0;
    line-height: 1.5;
}

/* Toggle Switch */
.mg-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.mg-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mg-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.mg-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .mg-slider {
    background-color: #1a73e8;
}

input:checked + .mg-slider:before {
    transform: translateX(24px);
}

.mg-switch.disabled .mg-slider {
    background-color: #1a73e8;
    opacity: 0.6;
    cursor: not-allowed;
}

.mg-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .mg-modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
        width: 100%;
    }
    
    .mg-modal-footer {
        flex-direction: column-reverse;
    }
    
    .mg-modal-footer .mg-btn {
        width: 100%;
    }
}

.mg-cookie-table {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.mg-cookie-row {
    font-size: 13px;
    line-height: 1.8;
    color: #4a4a4a;
}

.mg-cookie-row strong {
    color: #1a1a1a;
}

.mg-tab-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
    color: #1a1a1a;
}

.mg-tab-content h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 20px 0 8px;
    color: #1a1a1a;
}

.mg-tab-content p {
    font-size: 14px;
    line-height: 1.6;
    color: #4a4a4a;
    margin: 0 0 16px;
}

.mg-tab-content ul {
    margin: 8px 0 16px;
    padding-left: 24px;
}

.mg-tab-content li {
    font-size: 14px;
    line-height: 1.6;
    color: #4a4a4a;
    margin-bottom: 4px;
}