/* AYPN Mail - Public Frontend CSS */

/* ========================================
   CSS Custom Properties
   ======================================== */

:root {
    --wpmf-pub-primary: #4F46E5;
    --wpmf-pub-primary-dark: #4338ca;
    --wpmf-pub-success: #10B981;
    --wpmf-pub-error: #EF4444;
    --wpmf-pub-warning: #F59E0B;
    --wpmf-pub-text: #1f2937;
    --wpmf-pub-text-light: #6b7280;
    --wpmf-pub-border: #d1d5db;
    --wpmf-pub-bg: #ffffff;
    --wpmf-pub-radius: 8px;
    --wpmf-pub-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* ========================================
   Base Form Styles
   ======================================== */

.wpmf-form {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    color: var(--wpmf-pub-text);
    line-height: 1.5;
}

.wpmf-form *,
.wpmf-form *::before,
.wpmf-form *::after {
    box-sizing: border-box;
}

.wpmf-form-group {
    margin-bottom: 16px;
}

.wpmf-form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--wpmf-pub-text);
}

.wpmf-form-label .required {
    color: var(--wpmf-pub-error);
    margin-left: 2px;
}

.wpmf-form-input,
.wpmf-form-select,
.wpmf-form-textarea {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--wpmf-pub-text);
    background: var(--wpmf-pub-bg);
    border: 1.5px solid var(--wpmf-pub-border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.wpmf-form-input::placeholder,
.wpmf-form-textarea::placeholder {
    color: #9ca3af;
}

.wpmf-form-input:hover,
.wpmf-form-select:hover,
.wpmf-form-textarea:hover {
    border-color: #9ca3af;
}

.wpmf-form-input:focus,
.wpmf-form-select:focus,
.wpmf-form-textarea:focus {
    border-color: var(--wpmf-pub-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.wpmf-form-input.error,
.wpmf-form-select.error,
.wpmf-form-textarea.error {
    border-color: var(--wpmf-pub-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.wpmf-form-input:disabled,
.wpmf-form-select:disabled {
    background: #f9fafb;
    cursor: not-allowed;
    opacity: 0.7;
}

.wpmf-form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.wpmf-form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Inline form variant */
.wpmf-form-inline .wpmf-form-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.wpmf-form-inline .wpmf-form-input {
    flex: 1;
}

.wpmf-form-inline .wpmf-form-group {
    margin-bottom: 0;
}

/* Two column layout */
.wpmf-form-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
}

@media (max-width: 480px) {
    .wpmf-form-cols {
        grid-template-columns: 1fr;
    }
    .wpmf-form-inline .wpmf-form-row {
        flex-direction: column;
    }
}

/* ========================================
   Checkboxes and Radios
   ======================================== */

.wpmf-checkbox-wrap,
.wpmf-radio-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 8px;
}

.wpmf-checkbox-wrap input[type="checkbox"],
.wpmf-radio-wrap input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--wpmf-pub-primary);
    cursor: pointer;
}

.wpmf-checkbox-text,
.wpmf-radio-text {
    font-size: 14px;
    color: var(--wpmf-pub-text);
    line-height: 1.5;
    flex: 1;
}

.wpmf-checkbox-text a,
.wpmf-radio-text a {
    color: var(--wpmf-pub-primary);
    text-decoration: underline;
}

/* GDPR */
.wpmf-gdpr-group {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 16px;
}

.wpmf-gdpr-group .wpmf-checkbox-text {
    font-size: 13px;
    color: var(--wpmf-pub-text-light);
}

/* ========================================
   Submit Button
   ======================================== */

.wpmf-form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--wpmf-pub-primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    text-decoration: none;
    user-select: none;
}

.wpmf-form-submit:hover:not(:disabled) {
    background: var(--wpmf-pub-primary-dark);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.wpmf-form-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.wpmf-form-submit:disabled,
.wpmf-form-submit.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.wpmf-form-submit.full-width {
    display: flex;
    width: 100%;
}

/* Spinner inside button */
.wpmf-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wpmf-spin 0.6s linear infinite;
    flex-shrink: 0;
}

@keyframes wpmf-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Field Validation Messages
   ======================================== */

.wpmf-field-error {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 13px;
    color: var(--wpmf-pub-error);
    animation: wpmf-shake 0.3s ease;
}

.wpmf-field-error::before {
    content: '⚠';
    flex-shrink: 0;
}

@keyframes wpmf-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.wpmf-form-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #b91c1c;
}

/* ========================================
   Success Message
   ======================================== */

.wpmf-form-success {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    animation: wpmf-fade-in 0.4s ease;
}

.wpmf-form-success.visible {
    display: flex;
}

.wpmf-success-icon {
    width: 56px;
    height: 56px;
    background: #d1fae5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
    color: var(--wpmf-pub-success);
}

.wpmf-success-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--wpmf-pub-text);
    margin: 0 0 8px;
}

.wpmf-success-message {
    font-size: 15px;
    color: var(--wpmf-pub-text-light);
    margin: 0;
    line-height: 1.6;
}

@keyframes wpmf-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Honeypot (spam protection)
   ======================================== */

.wpmf-hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    pointer-events: none;
    tab-index: -1;
}

/* ========================================
   Card Form Variant
   ======================================== */

.wpmf-form-card {
    background: var(--wpmf-pub-bg);
    border-radius: var(--wpmf-pub-radius);
    box-shadow: var(--wpmf-pub-shadow);
    padding: 32px;
}

.wpmf-form-card-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--wpmf-pub-text);
    margin: 0 0 6px;
}

.wpmf-form-card-description {
    font-size: 14px;
    color: var(--wpmf-pub-text-light);
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ========================================
   Popup / Overlay
   ======================================== */

.wpmf-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.wpmf-popup-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.wpmf-popup-container {
    background: var(--wpmf-pub-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.3s;
}

.wpmf-popup-overlay.visible .wpmf-popup-container {
    transform: scale(1) translateY(0);
}

.wpmf-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 1;
}

.wpmf-popup-close:hover {
    background: #e5e7eb;
    color: var(--wpmf-pub-text);
}

.wpmf-popup-header {
    padding: 24px 24px 0;
}

.wpmf-popup-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--wpmf-pub-text);
}

.wpmf-popup-header p {
    font-size: 14px;
    color: var(--wpmf-pub-text-light);
    margin: 0;
    line-height: 1.5;
}

.wpmf-popup-body {
    padding: 20px 24px 24px;
}

/* ========================================
   Slide-in
   ======================================== */

.wpmf-slide-in {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 340px;
    background: var(--wpmf-pub-bg);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 99997;
    transform: translateY(calc(100% + 32px));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wpmf-slide-in.visible {
    transform: translateY(0);
}

.wpmf-slide-in-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 0;
}

.wpmf-slide-in-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--wpmf-pub-text);
}

.wpmf-slide-in-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 18px;
    line-height: 1;
    padding: 0;
}

.wpmf-slide-in-close:hover {
    color: var(--wpmf-pub-text);
}

.wpmf-slide-in-body {
    padding: 12px 16px 16px;
}

@media (max-width: 380px) {
    .wpmf-slide-in {
        right: 0;
        bottom: 0;
        width: 100%;
        border-radius: 12px 12px 0 0;
    }
}

/* ========================================
   Floating Bar
   ======================================== */

.wpmf-floating-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--wpmf-pub-primary);
    color: #fff;
    z-index: 99996;
    padding: 12px 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.wpmf-floating-bar.visible {
    transform: translateY(0);
}

.wpmf-floating-bar.top {
    top: 0;
    bottom: auto;
    transform: translateY(-100%);
}

.wpmf-floating-bar.top.visible {
    transform: translateY(0);
}

.wpmf-floating-bar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.wpmf-floating-bar-text {
    font-size: 15px;
    font-weight: 500;
    flex-shrink: 0;
}

.wpmf-floating-bar .wpmf-form {
    display: flex;
    gap: 8px;
}

.wpmf-floating-bar .wpmf-form-input {
    padding: 8px 14px;
    font-size: 14px;
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    color: #fff;
    min-width: 220px;
}

.wpmf-floating-bar .wpmf-form-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.wpmf-floating-bar .wpmf-form-submit {
    background: #fff;
    color: var(--wpmf-pub-primary);
    padding: 8px 20px;
    font-size: 14px;
}

.wpmf-floating-bar .wpmf-form-submit:hover {
    background: #f0effe;
    box-shadow: none;
}

.wpmf-floating-bar-dismiss {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.wpmf-floating-bar-dismiss:hover {
    color: #fff;
}

@media (max-width: 600px) {
    .wpmf-floating-bar-inner {
        flex-direction: column;
        gap: 10px;
    }
    .wpmf-floating-bar .wpmf-form {
        flex-direction: column;
        width: 100%;
    }
    .wpmf-floating-bar .wpmf-form-input {
        min-width: 0;
        width: 100%;
    }
    .wpmf-floating-bar .wpmf-form-submit {
        width: 100%;
    }
}

/* ========================================
   Public Pages (Unsubscribe, Confirm, Manage)
   ======================================== */

.wpmf-public-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wpmf-public-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--wpmf-pub-shadow);
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.wpmf-public-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 24px;
}

.wpmf-public-icon.success {
    background: #d1fae5;
    color: var(--wpmf-pub-success);
}

.wpmf-public-icon.error {
    background: #fee2e2;
    color: var(--wpmf-pub-error);
}

.wpmf-public-icon.info {
    background: #ede9fe;
    color: var(--wpmf-pub-primary);
}

.wpmf-public-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wpmf-pub-text);
    margin: 0 0 12px;
}

.wpmf-public-message {
    font-size: 16px;
    color: var(--wpmf-pub-text-light);
    margin: 0 0 28px;
    line-height: 1.6;
}

.wpmf-public-email {
    display: inline-block;
    background: #f3f4f6;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--wpmf-pub-text);
    font-weight: 500;
    margin-bottom: 24px;
}

.wpmf-public-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wpmf-public-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 24px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.wpmf-public-btn-primary {
    background: var(--wpmf-pub-primary);
    color: #fff;
}

.wpmf-public-btn-primary:hover {
    background: var(--wpmf-pub-primary-dark);
}

.wpmf-public-btn-ghost {
    background: transparent;
    color: var(--wpmf-pub-text-light);
    border: 1px solid var(--wpmf-pub-border);
}

.wpmf-public-btn-ghost:hover {
    border-color: #9ca3af;
    color: var(--wpmf-pub-text);
}

.wpmf-public-btn-danger {
    background: transparent;
    color: var(--wpmf-pub-error);
    border: 1px solid #fecaca;
}

.wpmf-public-btn-danger:hover {
    background: #fee2e2;
}

.wpmf-public-footer {
    margin-top: 32px;
    font-size: 12px;
    color: #9ca3af;
}

.wpmf-public-footer a {
    color: var(--wpmf-pub-primary);
    text-decoration: none;
}

/* Manage Subscriptions page */
.wpmf-manage-lists {
    text-align: left;
    margin: 20px 0;
}

.wpmf-manage-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.wpmf-manage-list-item:hover {
    border-color: var(--wpmf-pub-primary);
}

.wpmf-manage-list-item input[type="checkbox"] {
    accent-color: var(--wpmf-pub-primary);
    width: 18px;
    height: 18px;
}

.wpmf-manage-list-name {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    margin: 0 12px;
}

.wpmf-manage-list-desc {
    font-size: 12px;
    color: #9ca3af;
}

@media (max-width: 520px) {
    .wpmf-public-card {
        padding: 32px 24px;
    }
}
