/*
 * Mianea AI Newsletter Manager - Custom Stylesheet
 *
 * This file complements Tailwind CSS to apply base styles and custom
 * component styles that are consistent across the application.
 */

/* Apply base font and background to the body */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    position: relative;
}

/* Custom styles for the newsletter card selection */
.newsletter-card.selected {
    border-color: hsl(221.2 83.2% 53.3%); /* Corresponds to Tailwind's ring-primary */
    background-color: hsl(222.2 47.4% 95.2%); /* A lighter shade for selection */
    box-shadow: 0 0 0 2px hsl(221.2 83.2% 53.3%);
}

/* Styling for the toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px; /* w-11 */
    height: 24px; /* h-6 */
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb; /* gray-200 */
    transition: .4s;
    border-radius: 9999px; /* rounded-full */
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px; /* h-5 */
    width: 20px; /* w-5 */
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #2563eb; /* blue-600 */
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Styles for the new collapsible newsletter category feature */
.category-header {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    transition: background-color 0.2s;
}
.category-header:hover {
    background-color: #f3f4f6;
}
.category-header h4 {
    font-weight: 600;
    color: #111827;
}
.category-icon {
    transition: transform 0.3s ease;
}
.category-header.active .category-icon {
    transform: rotate(45deg);
}
.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-in-out;
    padding-left: 8px; /* Slight indent for content */
}
.newsletter-card.limit-exceeded {
    border-color: #ef4444; /* red-500 */
    background-color: #fee2e2; /* red-100 */
    position: relative;
}
.newsletter-card.limit-exceeded::after {
    content: 'FREE LIMIT EXCEEDED';
    position: absolute;
    top: -1px;
    right: -1px;
    background-color: #ef4444; /* red-500 */
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-top-right-radius: 7px;
    border-bottom-left-radius: 7px;
}

/* Styles for the new collapsible changelog feature (Admin Panel) */
.changelog-container {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.changelog-container:last-of-type {
    border-bottom: none;
}
.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.changelog-header:hover h4 {
    color: #4f46e5;
}
.changelog-header.active .changelog-icon {
    transform: rotate(45deg);
}
.changelog-icon {
    color: #9ca3af;
    transition: transform 0.3s ease;
}

/* Regole per il contenuto collassabile */
.changelog-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}
.changelog-header.active + .changelog-content {
    max-height: 1000px; /* Valore grande per permettere l'espansione */
}

/* Custom Toggle Switch for Maintenance Mode */
.dot {
    transition: transform 0.2s;
}

input:checked + .block {
    background-color: #ef4444; /* red-500 */
}

input:checked ~ .dot {
    transform: translateX(100%);
}

/* --- GDPR Cookie Consent Banner --- */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #ffffff;
    padding: 1.5rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.5s ease-in-out;
    border-top: 1px solid #e5e7eb;
}

.cookie-consent-banner.active {
    transform: translateY(0);
}

.cookie-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(17, 24, 39, 0.6);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.cookie-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.cookie-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 999;
    width: 90%;
    max-width: 500px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.cookie-modal.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

/* Custom Toggle Switch for Cookie Settings */
.cookie-toggle-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.cookie-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}
.cookie-toggle-slider {
    width: 44px; /* w-11 */
    height: 24px; /* h-6 */
    background-color: #d1d5db; /* gray-300 */
    border-radius: 9999px;
    transition: background-color 0.2s;
}
.cookie-toggle-input:checked + .cookie-toggle-slider {
    background-color: #3b82f6; /* blue-500 */
}
.cookie-toggle-dot {
    position: absolute;
    height: 20px;
    width: 20px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.cookie-toggle-input:checked ~ .cookie-toggle-dot {
    transform: translateX(20px);
}