/**
 * Frontend CSS for Subscribe Manager
 */

/* Base Styles */
.sm-subscribe-form,
.sm-unsubscribe-form {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
}

.sm-subscribe-form *,
.sm-unsubscribe-form * {
    box-sizing: border-box;
}

/* Form Elements */
.sm-subscribe-form .form-group,
.sm-unsubscribe-form .form-group {
    margin-bottom: 20px;
}

.sm-subscribe-form label,
.sm-unsubscribe-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.sm-subscribe-form .required,
.sm-unsubscribe-form .required {
    color: #d63638;
}

.sm-subscribe-form input,
.sm-subscribe-form select,
.sm-unsubscribe-form input,
.sm-unsubscribe-form select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.4;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}

.sm-subscribe-form input:focus,
.sm-subscribe-form select:focus,
.sm-unsubscribe-form input:focus,
.sm-unsubscribe-form select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.sm-subscribe-form input.sm-error,
.sm-unsubscribe-form input.sm-error {
    border-color: #d63638;
    box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.1);
}

/* Button Styles */
.sm-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #007cba 0%, #005a87 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;
}

.sm-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87 0%, #004466 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.sm-submit-btn:active {
    transform: translateY(0);
}

.sm-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.sm-btn-loading {
    display: none;
}

.sm-submit-btn:disabled .sm-btn-text {
    display: none;
}

.sm-submit-btn:disabled .sm-btn-loading {
    display: inline;
}

/* Categories */
.sm-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.sm-category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sm-category-item:hover {
    background-color: #f0f0f1;
}

.sm-category-item input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.sm-checkbox-label {
    font-weight: normal;
    margin: 0;
    cursor: pointer;
}

/* GDPR Consent */
.sm-gdpr-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.sm-gdpr-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

.sm-gdpr-label a {
    color: #007cba;
    text-decoration: none;
}

.sm-gdpr-label a:hover {
    text-decoration: underline;
}

/* Messages */
.sm-messages {
    margin-top: 20px;
}

.sm-success,
.sm-error {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
}

.sm-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.sm-error {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.sm-field-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Form Title and Description */
.sm-form-title {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1d2327;
    text-align: center;
}

.sm-form-description {
    margin: 0 0 24px 0;
    color: #646970;
    text-align: center;
    font-size: 16px;
}

/* Loading State */
.sm-subscribe-form.loading,
.sm-unsubscribe-form.loading {
    pointer-events: none;
}

.sm-subscribe-form.loading::after,
.sm-unsubscribe-form.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

/* Style Variations */

/* Default Style */
.sm-style-default {
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Minimal Style */
.sm-style-minimal {
    padding: 20px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.sm-style-minimal .sm-form-title {
    font-size: 20px;
    margin-bottom: 12px;
}

.sm-style-minimal .sm-form-description {
    font-size: 14px;
    margin-bottom: 16px;
}

.sm-style-minimal input,
.sm-style-minimal select {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
}

.sm-style-minimal .sm-submit-btn {
    padding: 10px 16px;
    background: #333;
    border-radius: 3px;
    font-size: 14px;
}

/* Modern Style */
.sm-style-modern {
    padding: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    position: relative;
    overflow: hidden;
}

.sm-style-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 1;
}

.sm-style-modern > * {
    position: relative;
    z-index: 2;
}

.sm-style-modern .sm-form-title {
    color: white;
    font-size: 28px;
    margin-bottom: 20px;
}

.sm-style-modern .sm-form-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin-bottom: 30px;
}

.sm-style-modern label {
    color: white;
    font-weight: 500;
}

.sm-style-modern input,
.sm-style-modern select {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 14px 18px;
    font-size: 16px;
}

.sm-style-modern input:focus,
.sm-style-modern select:focus {
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.sm-style-modern .sm-submit-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 8px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sm-style-modern .sm-submit-btn:hover:not(:disabled) {
    background: white;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.sm-style-modern .sm-category-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sm-style-modern .sm-gdpr-label {
    color: rgba(255, 255, 255, 0.9);
}

.sm-style-modern .sm-gdpr-label a {
    color: white;
    text-decoration: underline;
}

/* Stats Display */
.sm-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.sm-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-width: 120px;
}

.sm-stat-label {
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.sm-stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #007cba;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sm-subscribe-form,
    .sm-unsubscribe-form {
        padding: 20px;
        margin: 10px;
    }
    
    .sm-form-title {
        font-size: 20px;
    }
    
    .sm-form-description {
        font-size: 14px;
    }
    
    .sm-categories {
        gap: 8px;
    }
    
    .sm-category-item {
        padding: 6px 8px;
    }
    
    .sm-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .sm-stat-item {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sm-subscribe-form,
    .sm-unsubscribe-form {
        padding: 15px;
        margin: 5px;
    }
    
    .sm-form-title {
        font-size: 18px;
    }
    
    .sm-submit-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .sm-style-modern {
        padding: 25px;
    }
    
    .sm-style-modern .sm-form-title {
        font-size: 22px;
    }
}

/* Animation Classes */
.sm-fade-in {
    animation: smFadeIn 0.5s ease-in-out;
}

.sm-slide-up {
    animation: smSlideUp 0.5s ease-out;
}

@keyframes smFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes smSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Accessibility */
.sm-subscribe-form:focus-within,
.sm-unsubscribe-form:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.sm-submit-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .sm-subscribe-form,
    .sm-unsubscribe-form {
        border: 2px solid #000;
    }
    
    .sm-submit-btn {
        background: #000;
        border: 2px solid #000;
    }
    
    .sm-submit-btn:hover:not(:disabled) {
        background: #333;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .sm-submit-btn,
    .sm-category-item,
    .sm-subscribe-form input,
    .sm-unsubscribe-form input {
        transition: none;
    }
    
    .sm-fade-in,
    .sm-slide-up {
        animation: none;
    }
}
