/**
 * Frontend CSS for Myragen Lead Collection Forms
 */

/* ==========================================================================
   SUBSCRIPTION FORMS
   ========================================================================== */

.myragen-subscription-form {
    margin: 20px 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 500px;
}

.myragen-form-title {
    margin: 0 0 10px 0;
    font-size: 1.5em;
    color: #333;
    text-align: center;
}

.myragen-form-description {
    margin: 0 0 20px 0;
    color: #666;
    text-align: center;
    font-size: 0.95em;
    line-height: 1.5;
}

.myragen-form-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.myragen-field {
    display: flex;
    flex-direction: column;
}

.myragen-input {
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: #fff;
}

.myragen-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.myragen-input.error {
    border-color: #dc3545;
}

.myragen-submit-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #0073aa 0%, #005177 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.myragen-submit-btn:hover {
    background: linear-gradient(135deg, #005177 0%, #0073aa 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 115, 170, 0.3);
}

.myragen-submit-btn:active {
    transform: translateY(0);
}

.myragen-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.myragen-btn-loading {
    display: none;
}

.myragen-submit-btn.loading .myragen-btn-text {
    display: none;
}

.myragen-submit-btn.loading .myragen-btn-loading {
    display: inline;
}

.myragen-form-message {
    padding: 12px 15px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
}

.myragen-form-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.myragen-form-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ==========================================================================
   FORM STYLES VARIATIONS
   ========================================================================== */

.myragen-style-minimal {
    background: transparent;
    box-shadow: none;
    border: 1px solid #e1e5e9;
    padding: 15px;
}

.myragen-style-compact .myragen-form-fields {
    flex-direction: row;
    align-items: flex-end;
}

.myragen-style-compact .myragen-field {
    flex: 1;
}

.myragen-style-compact .myragen-field:last-child {
    flex: 0 0 auto;
    margin-left: 10px;
}

.myragen-style-rounded {
    border-radius: 20px;
}

.myragen-style-rounded .myragen-input,
.myragen-style-rounded .myragen-submit-btn {
    border-radius: 25px;
}

/* ==========================================================================
   POPUP FORMS
   ========================================================================== */

.myragen-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.myragen-popup-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.myragen-popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    z-index: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.myragen-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.myragen-popup-inner {
    padding: 40px 30px 30px;
    text-align: center;
}

.myragen-popup-title {
    margin: 0 0 15px 0;
    font-size: 1.8em;
    color: #333;
    font-weight: 700;
}

.myragen-popup-description {
    margin: 0 0 25px 0;
    color: #666;
    font-size: 1.1em;
    line-height: 1.6;
}

.myragen-popup-fields {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.myragen-popup-fields .myragen-input {
    flex: 1;
    min-width: 200px;
}

.myragen-popup-fields .myragen-submit-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .myragen-subscription-form {
        margin: 15px 0;
        padding: 15px;
    }
    
    .myragen-style-compact .myragen-form-fields {
        flex-direction: column;
    }
    
    .myragen-style-compact .myragen-field:last-child {
        margin-left: 0;
        margin-top: 15px;
    }
    
    .myragen-popup-inner {
        padding: 30px 20px 20px;
    }
    
    .myragen-popup-title {
        font-size: 1.5em;
    }
    
    .myragen-popup-fields {
        flex-direction: column;
    }
    
    .myragen-popup-fields .myragen-input {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .myragen-popup-content {
        width: 95%;
        margin: 10px;
    }
    
    .myragen-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ==========================================================================
   WIDGET STYLES
   ========================================================================== */

.widget .myragen-subscription-form {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

.widget .myragen-form-title {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.widget .myragen-form-description {
    font-size: 0.9em;
    margin-bottom: 15px;
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.myragen-input:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.myragen-submit-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.myragen-popup-close:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Screen reader only content */
.myragen-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   DARK MODE SUPPORT
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .myragen-subscription-form {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .myragen-form-title {
        color: #f7fafc;
    }
    
    .myragen-form-description {
        color: #a0aec0;
    }
    
    .myragen-input {
        background: #4a5568;
        border-color: #718096;
        color: #f7fafc;
    }
    
    .myragen-input:focus {
        border-color: #63b3ed;
    }
    
    .myragen-popup-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .myragen-popup-title {
        color: #f7fafc;
    }
    
    .myragen-popup-description {
        color: #a0aec0;
    }
    
    .myragen-popup-close {
        color: #a0aec0;
    }
    
    .myragen-popup-close:hover {
        background: #4a5568;
        color: #f7fafc;
    }
}
