/**
 * BPG Content Gate - Frontend Styles
 * Styling for gated content, subscription modal, and form
 */

/* Content Gate Styles */
.bpg-content-gate {
    margin: 40px 0;
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    text-align: center;
    color: #ffffff !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.bpg-content-gate h3 {
    margin-top: 0;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff !important;
}

.bpg-content-gate p,
.bpg-gate-message p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 25px;
    color: #ffffff !important;
    opacity: 0.95;
}

.bpg-content-excerpt {
    position: relative;
    max-height: 80px;
    overflow: hidden;
    margin-bottom: 30px;
}

.bpg-content-excerpt::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
    pointer-events: none;
}

/* Button Styles */
.bpg-open-modal-btn {
    display: inline-block;
    padding: 15px 40px;
    background: #ffffff;
    color: #667eea;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.bpg-open-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Modal Styles */
.bpg-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.bpg-modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 40px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.bpg-modal-close {
    color: #aaa;
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.bpg-modal-close:hover,
.bpg-modal-close:focus {
    color: #000;
}

.bpg-modal-content h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #333;
    font-size: 26px;
    font-weight: 700;
}

/* Form Styles */
#bpg-subscription-form {
    margin-top: 20px;
}

.bpg-form-group {
    margin-bottom: 20px;
    text-align: left;
}

.bpg-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #444;
    font-weight: 500;
    font-size: 14px;
}

.bpg-form-group input[type="email"],
.bpg-form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.bpg-form-group input[type="email"]:focus,
.bpg-form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.bpg-form-group input[type="checkbox"] {
    margin-right: 8px;
}

.bpg-form-group label a {
    color: #667eea;
    text-decoration: underline;
}

.bpg-submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.bpg-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.bpg-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Form Messages */
.bpg-form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

.bpg-form-message.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.bpg-form-message.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Gated Shortcode */
.bpg-gated-shortcode {
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    color: #666;
    font-style: italic;
    margin: 20px 0;
}

/* Content Unlocked */
.bpg-content-full {
    animation: fadeInContent 0.5s ease;
}

@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .bpg-modal-content {
        margin: 10% auto;
        padding: 30px 20px;
        width: 95%;
    }
    
    .bpg-content-gate {
        padding: 30px 20px;
    }
    
    .bpg-content-gate h3 {
        font-size: 22px;
    }
    
    .bpg-gate-message p {
        font-size: 14px;
    }
    
    .bpg-open-modal-btn {
        padding: 12px 30px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .bpg-modal-content h2 {
        font-size: 22px;
    }
    
    .bpg-form-group input[type="email"],
    .bpg-form-group input[type="text"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Loading State */
.bpg-loading {
    position: relative;
    pointer-events: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Inline button spinner */
.bpg-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
    position: relative;
    top: -1px;
}

/* Modal Logo */
.bpg-modal-logo {
    text-align: center;
    margin-bottom: 16px;
}

.bpg-modal-logo img {
    max-height: 60px;
    max-width: 200px;
    width: auto;
    display: inline-block;
}

/* Modal Subhead */
.bpg-modal-subhead {
    color: #666;
    font-size: 14px;
    margin-top: -15px;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Optional Fields Section */
.bpg-form-optional {
    margin-top: 25px;
    margin-bottom: 20px;
    padding-top: 20px;
    border-top: 1px dashed #e1e8ed;
    background-color: #fafbfc;
    padding: 20px;
    border-radius: 8px;
    margin-left: -15px;
    margin-right: -15px;
    padding-left: 15px;
    padding-right: 15px;
}

.bpg-optional-intro {
    margin-bottom: 15px;
    margin-top: 0;
    color: #666;
    font-style: italic;
    text-align: center;
}

.bpg-optional-intro small {
    font-size: 13px;
}

/* Optional label styling */
.bpg-form-group label .optional {
    color: #999;
    font-weight: normal;
    font-size: 12px;
    font-style: italic;
}

/* Visual indicator that fields are optional */
.bpg-form-optional input[type="text"] {
    border-color: #d8dfe6;
    background-color: #ffffff;
}

.bpg-form-optional input[type="text"]:focus {
    border-color: #667eea;
    background-color: #ffffff;
}

.bpg-form-optional input[type="text"]::placeholder {
    color: #aaa;
    font-style: italic;
}

/* Autofilled fields get a subtle highlight */
.bpg-form-optional input[type="text"].autofilled {
    background-color: #fffbcc;
    border-color: #f7dc6f;
}

/* Consent checkbox styling */
.bpg-consent {
    margin-top: 20px;
}

.bpg-consent label {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

.bpg-consent input[type="checkbox"] {
    margin-right: 8px;
    vertical-align: middle;
}

/* Trust signals below button */
.bpg-trust-signals {
    text-align: center;
    margin-top: 15px;
    padding-top: 10px;
    color: #888;
}

.bpg-trust-signals small {
    font-size: 12px;
    line-height: 1.4;
}

/* Sign-in link */
.bpg-signin-link {
    text-align: center;
    margin-top: 12px;
    color: #666;
    font-size: 13px;
}

.bpg-signin-link a,
.bpg-switch-subscribe {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.bpg-signin-link a:hover,
.bpg-switch-subscribe:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Sign-in mode (returning subscribers) */
.bpg-mode-signin .bpg-form-optional,
.bpg-mode-signin .bpg-consent,
.bpg-mode-signin .bpg-trust-signals {
    display: none !important;
}

.bpg-mode-signin #bpg-email {
    margin-bottom: 5px;
}

/* Mobile adjustments for optional fields */
@media (max-width: 768px) {
    .bpg-form-optional {
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Print Styles */
@media print {
    .bpg-content-gate,
    .bpg-open-modal-btn,
    #bpg-subscription-modal {
        display: none !important;
    }
    
    .bpg-content-full {
        display: block !important;
    }
}
