/**
 * Archihub Content Gate - Frontend Styles
 *
 * @package Archihub_Content_Gate
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Custom Properties (customizable via admin or theme)
   ========================================================================== */

:root {
    /* Popup */
    --acg-popup-bg: #ffffff;
    --acg-title-color: #1e293b;
    --acg-text-color: #64748b;
    --acg-border-radius: 12px;

    /* Buttons */
    --acg-primary-color: #2563eb;
    --acg-primary-hover: color-mix(in srgb, var(--acg-primary-color) 85%, black);
    --acg-primary-text: #ffffff;
    --acg-secondary-bg: #f8fafc;
    --acg-secondary-hover: #f1f5f9;
    --acg-secondary-color: #64748b;
    --acg-secondary-border: #e2e8f0;

    /* Icon */
    --acg-icon-bg: #e0e7ff;
    --acg-icon-color: #2563eb;

    /* Overlay */
    --acg-overlay-color: rgba(0, 0, 0, 0.5);

    /* Toast */
    --acg-toast-bg: #1e293b;
    --acg-toast-color: #ffffff;

    /* Other */
    --acg-border-radius-sm: calc(var(--acg-border-radius) - 4px);
    --acg-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --acg-z-popup: 999999;
    --acg-z-toast: 999998;
}

/* ==========================================================================
   Popup Overlay
   ========================================================================== */

.acg-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--acg-overlay-color);
    z-index: var(--acg-z-popup);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.acg-popup-overlay.acg-active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Popup Container
   ========================================================================== */

.acg-popup-container {
    background: var(--acg-popup-bg);
    border-radius: var(--acg-border-radius);
    padding: 40px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    position: relative;
    box-shadow: var(--acg-shadow);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.acg-popup-overlay.acg-active .acg-popup-container {
    transform: scale(1) translateY(0);
}

/* Close Button */
.acg-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--acg-text-color);
    transition: background-color 0.2s ease, color 0.2s ease;
    line-height: 0;
}

.acg-popup-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--acg-title-color);
}

.acg-popup-close:focus {
    outline: 2px solid var(--acg-primary-color);
    outline-offset: 2px;
}

/* Icon */
.acg-popup-icon {
    width: 80px;
    height: 80px;
    background: var(--acg-icon-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: var(--acg-icon-color);
}

/* Title */
.acg-popup-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--acg-title-color);
    margin: 0 0 12px;
    line-height: 1.3;
}

/* Message */
.acg-popup-message {
    font-size: 16px;
    color: var(--acg-text-color);
    margin: 0 0 28px;
    line-height: 1.6;
}

.acg-popup-message p {
    margin: 0 0 10px;
}

.acg-popup-message p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.acg-popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.acg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--acg-border-radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.acg-btn:focus {
    outline: 2px solid var(--acg-primary-color);
    outline-offset: 2px;
}

/* Primary Button */
.acg-btn-primary {
    background: var(--acg-primary-color);
    color: var(--acg-primary-text);
    border-color: var(--acg-primary-color);
}

.acg-btn-primary:hover {
    background: var(--acg-primary-hover);
    border-color: var(--acg-primary-hover);
    color: var(--acg-primary-text);
}

/* Secondary Button */
.acg-btn-secondary {
    background: var(--acg-secondary-bg);
    color: var(--acg-secondary-color);
    border-color: var(--acg-secondary-border);
}

.acg-btn-secondary:hover {
    background: var(--acg-secondary-hover);
    border-color: #cbd5e1;
    color: var(--acg-title-color);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.acg-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--acg-toast-bg);
    color: var(--acg-toast-color);
    padding: 16px 24px;
    border-radius: var(--acg-border-radius-sm);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: var(--acg-z-toast);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 90%;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                opacity 0.3s ease;
}

.acg-toast.acg-active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.acg-toast-icon {
    flex-shrink: 0;
    color: #fbbf24;
}

.acg-toast-message {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
}

/* ==========================================================================
   Protected Element Overlay (Optional Visual Indicator)
   ========================================================================== */

.acg-protected-overlay {
    position: relative;
}

.acg-protected-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
    z-index: 10;
    transition: background 0.3s ease;
}

.acg-protected-overlay:hover::before {
    background: rgba(37, 99, 235, 0.05);
}

/* Lock icon indicator */
.acg-protected-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--acg-primary-color);
    z-index: 11;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.acg-protected-overlay:hover .acg-protected-indicator {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   Accessibility & Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .acg-popup-overlay,
    .acg-popup-container,
    .acg-toast,
    .acg-btn {
        transition: none;
    }
}

/* ==========================================================================
   Mobile Responsive
   ========================================================================== */

@media screen and (max-width: 480px) {
    .acg-popup-container {
        padding: 30px 24px;
        margin: 10px;
    }

    .acg-popup-icon {
        width: 64px;
        height: 64px;
    }

    .acg-popup-icon svg {
        width: 36px;
        height: 36px;
    }

    .acg-popup-title {
        font-size: 20px;
    }

    .acg-popup-message {
        font-size: 15px;
    }

    .acg-btn {
        padding: 12px 20px;
        font-size: 15px;
    }

    .acg-toast {
        left: 10px;
        right: 10px;
        transform: translateX(0) translateY(-100px);
        max-width: none;
    }

    .acg-toast.acg-active {
        transform: translateX(0) translateY(0);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .acg-popup-overlay,
    .acg-toast {
        display: none !important;
    }
}
