/**
 * Sendwise Public Styles
 * 
 * Minimal, customizable styles for subscription forms
 */

/* Variables - can be overridden by themes */
:root {
    --stc-primary: #d4245f;
    --stc-primary-hover: #b81e50;
    --stc-text: #1f2937;
    --stc-text-light: #6b7280;
    --stc-border: #e5e7eb;
    --stc-bg: #ffffff;
    --stc-bg-light: #f9fafb;
    --stc-success: #059669;
    --stc-error: #dc2626;
    --stc-radius: 8px;
}

/* Base Form Styles */
.stc-form {
    font-family: inherit;
    font-size: 16px;
}

.stc-form * {
    box-sizing: border-box;
}

/* Input Styles */
.stc-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    color: var(--stc-text);
    background: var(--stc-bg);
    border: 1px solid var(--stc-border);
    border-radius: var(--stc-radius);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.stc-input:focus {
    border-color: var(--stc-primary);
    box-shadow: 0 0 0 3px rgba(212, 36, 95, 0.1);
}

.stc-input::placeholder {
    color: var(--stc-text-light);
}

/* Button Styles */
.stc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--stc-primary);
    border: none;
    border-radius: var(--stc-radius);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    white-space: nowrap;
}

.stc-button:hover {
    background: var(--stc-primary-hover);
}

.stc-button:active {
    transform: scale(0.98);
}

.stc-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.stc-button__loading {
    display: none;
}

.stc-form--loading .stc-button__text {
    display: none;
}

.stc-form--loading .stc-button__loading {
    display: inline-flex;
}

/* Spinner */
.stc-spinner {
    width: 20px;
    height: 20px;
    animation: stc-spin 1s linear infinite;
}

@keyframes stc-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Message Styles */
.stc-form__message {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--stc-radius);
    font-size: 14px;
    display: none;
}

.stc-form__message:not(:empty) {
    display: block;
}

.stc-form__message--success {
    background: #ecfdf5;
    color: var(--stc-success);
    border: 1px solid #a7f3d0;
}

.stc-form__message--error {
    background: #fef2f2;
    color: var(--stc-error);
    border: 1px solid #fecaca;
}

/* Checkbox/GDPR */
.stc-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: var(--stc-text-light);
    cursor: pointer;
}

.stc-checkbox input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--stc-primary);
}

.stc-checkbox__text a {
    color: var(--stc-primary);
}

/* Admin Error */
.stc-error {
    padding: 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--stc-radius);
    color: var(--stc-error);
    font-size: 14px;
}

.stc-error a {
    color: var(--stc-primary);
}

/* ===================
   Form Style: Default
   =================== */
.stc-form--default .stc-form__fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===================
   Form Style: Inline
   =================== */
.stc-form--inline .stc-form__fields {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.stc-form--inline .stc-form__field--email {
    flex: 1;
    min-width: 200px;
}

.stc-form--inline .stc-form__field--fname,
.stc-form--inline .stc-form__field--lname {
    flex: 0 0 auto;
    min-width: 150px;
}

.stc-form--inline .stc-form__field--submit {
    flex: 0 0 auto;
}

@media (max-width: 600px) {
    .stc-form--inline .stc-form__fields {
        flex-direction: column;
    }
    
    .stc-form--inline .stc-form__field--submit {
        width: 100%;
    }
    
    .stc-form--inline .stc-button {
        width: 100%;
    }
}

/* ===================
   Form Style: Minimal
   =================== */
.stc-form--minimal .stc-form__fields {
    display: flex;
    position: relative;
}

.stc-form--minimal .stc-form__field--email {
    flex: 1;
}

.stc-form--minimal .stc-input {
    padding-right: 120px;
    border-radius: 50px;
}

.stc-form--minimal .stc-form__field--submit {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.stc-form--minimal .stc-button {
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 14px;
}

@media (max-width: 480px) {
    .stc-form--minimal .stc-form__fields {
        flex-direction: column;
        gap: 8px;
    }
    
    .stc-form--minimal .stc-input {
        padding-right: 16px;
        border-radius: var(--stc-radius);
    }
    
    .stc-form--minimal .stc-form__field--submit {
        position: static;
        transform: none;
    }
    
    .stc-form--minimal .stc-button {
        width: 100%;
        border-radius: var(--stc-radius);
    }
}

/* ===================
   Form Style: Card
   =================== */
.stc-card {
    background: var(--stc-bg);
    border: 1px solid var(--stc-border);
    border-radius: 12px;
    padding: 32px;
    max-width: 480px;
}

.stc-card__title {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--stc-text);
}

.stc-card__description {
    margin: 0 0 24px;
    color: var(--stc-text-light);
    font-size: 16px;
    line-height: 1.5;
}

.stc-form--card .stc-form__fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stc-form--card .stc-button {
    width: 100%;
}

/* ===================
   Dark Mode Support
   =================== */
@media (prefers-color-scheme: dark) {
    .stc-form.stc-form--auto-dark {
        --stc-text: #f3f4f6;
        --stc-text-light: #9ca3af;
        --stc-border: #374151;
        --stc-bg: #1f2937;
        --stc-bg-light: #111827;
    }
}

/* Manual dark mode class */
.stc-form--dark {
    --stc-text: #f3f4f6;
    --stc-text-light: #9ca3af;
    --stc-border: #374151;
    --stc-bg: #1f2937;
    --stc-bg-light: #111827;
}

.stc-card--dark {
    --stc-text: #f3f4f6;
    --stc-text-light: #9ca3af;
    --stc-border: #374151;
    --stc-bg: #1f2937;
}

/* ===================
   Success State
   =================== */
.stc-form--success .stc-form__fields {
    display: none;
}

.stc-form--success .stc-form__gdpr {
    display: none;
}
