/**
 * Forms & Buttons Styles
 * Shared form controls, buttons, and feedback messages
 * 
 * Requires: common.css (for CSS variables)
 */

/* ============================================================================
   FORM GROUPS & LABELS
   ============================================================================ */

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary, #333);
    margin-bottom: 0.5rem;
}

.input-helper {
    color: var(--text-muted, #999);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ============================================================================
   TEXT INPUTS
   ============================================================================ */

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 3px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
    border-color: var(--brand-primary, #c41e3a);
}

input::placeholder {
    color: var(--text-muted, #999);
}

/* Constrained width variant */
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    max-width: 400px;
}

/* Full width variant */
.form-group.full-width input {
    max-width: none;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: 3px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Primary button */
.btn-primary {
    background: var(--brand-primary, #c41e3a);
    color: white;
    border: none;
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-primary-hover, #a01730);
}

/* Full-width primary (for forms) */
button.btn-primary[type="submit"],
.btn-primary.full-width {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
    margin-top: 1rem;
}

/* Secondary button */
.btn-secondary {
    background: var(--bg-white, white);
    color: var(--text-secondary, #666);
    border: 1px solid var(--border-color, #ddd);
}

.btn-secondary:hover:not(:disabled) {
    border-color: #999;
}

/* Danger button */
.btn-danger {
    background: var(--bg-white, white);
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-danger:hover:not(:disabled) {
    background: #dc3545;
    color: white;
}

/* Link-style button */
.btn-link {
    background: none;
    color: var(--brand-primary, #c41e3a);
    border: none;
    padding: 0;
    font-size: 0.9rem;
    text-decoration: underline;
    cursor: pointer;
}

.btn-link:hover {
    color: var(--brand-primary-hover, #a01730);
}

/* Button group */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        width: 100%;
    }
}

/* ============================================================================
   ERROR & SUCCESS MESSAGES
   ============================================================================ */

.error-message,
.success-message {
    padding: 0.75rem;
    border-radius: 3px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.success-message {
    background: #efe;
    border: 1px solid #cfc;
    color: #3c3;
}

.error-message.show,
.success-message.show {
    display: block;
}

/* Success variant for error element (used in signup) */
.error-message.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* ============================================================================
   DIVIDER
   ============================================================================ */

.divider {
    text-align: center;
    margin: 2rem 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: #e5e5e5;
}

.divider span {
    background: var(--bg-white, white);
    padding: 0 1rem;
    color: var(--text-muted, #999);
    font-size: 0.85rem;
    position: relative;
}

/* ============================================================================
   LOGIN/SIGNUP LINKS
   ============================================================================ */

.login-link,
.signup-link {
    text-align: center;
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
    margin-top: 1.5rem;
}

.login-link a,
.signup-link a {
    color: var(--brand-primary, #c41e3a);
    text-decoration: none;
    font-weight: 500;
}

.login-link a:hover,
.signup-link a:hover {
    text-decoration: underline;
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-white, white);
    border-radius: 8px;
    padding: 2rem;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #333);
    margin: 0;
}

.modal-body {
    color: var(--text-secondary, #666);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.modal-body p {
    margin-bottom: 0.75rem;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-actions .btn {
    min-width: 100px;
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-admin {
    background: #fce4ec;
    color: #c2185b;
}

.status-user {
    background: #e3f2fd;
    color: #1976d2;
}

.status-subscriber {
    background: #e8f5e9;
    color: #388e3c;
}

.status-active {
    background: #e8f5e9;
    color: #388e3c;
}

.status-inactive {
    background: #ffebee;
    color: #c62828;
}

.status-cancelling {
    background: #fff3e0;
    color: #e65100;
}

.status-past-due {
    background: #ffebee;
    color: #c62828;
}

.status-cancelled {
    background: #fafafa;
    color: #757575;
}

.status-unknown {
    background: #f5f5f5;
    color: var(--text-secondary, #666);
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted, #999);
}

.loading-text {
    color: var(--text-muted, #999);
    font-size: 0.9rem;
}
