/**
 * Public Styles: Frontend Form Rendering
 *
 * This file styles the [tt24_form] shortcode output. It is highly optimized,
 * responsive, and uses CSS variables to ensure seamless theme integration
 * and easy customization for the website owner.
 *
 * @package    24TT_Unrestricted_Forms
 * @since      1.0.0
 * Contributors: 24techtime, johniouspatriot
 */

/* ==========================================================================
   1. CSS Variables (The Customization Engine)
   ========================================================================== */
:root {
    --tt24-primary-color: #007cba;       /* Brand Blue */
    --tt24-primary-hover: #005a87;       /* Darker Blue for hover states */
    --tt24-text-color: #333333;          /* Standard text */
    --tt24-border-color: #cccccc;        /* Input borders */
    --tt24-border-focus: #007cba;        /* Input border on focus */
    --tt24-bg-color: #ffffff;            /* Input backgrounds */
    --tt24-error-bg: #f8d7da;            /* Error message background */
    --tt24-error-text: #721c24;          /* Error message text */
    --tt24-success-bg: #d4edda;          /* Success message background */
    --tt24-success-text: #155724;        /* Success message text */
    --tt24-border-radius: 4px;           /* Standard rounded corners */
    --tt24-spacing: 15px;                /* Space between fields */
}

/* ==========================================================================
   2. Form Container & Layout
   ========================================================================== */
.tt24-form-wrapper {
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    font-family: inherit; /* Inherits the website's native font */
}

.tt24-unrestricted-form {
    display: flex;
    flex-direction: column;
    gap: var(--tt24-spacing);
}

.tt24-field-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================================================
   3. Typography & Labels
   ========================================================================== */
.tt24-field-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--tt24-text-color);
    font-size: 1rem;
    display: inline-block;
}

/* Red asterisk for required fields */
.tt24-field-group label .required-asterisk {
    color: #d63638;
    margin-left: 3px;
}

/* ==========================================================================
   4. Inputs & Textareas
   ========================================================================== */
.tt24-input,
.tt24-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    color: var(--tt24-text-color);
    background-color: var(--tt24-bg-color);
    border: 1px solid var(--tt24-border-color);
    border-radius: var(--tt24-border-radius);
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    max-width: 100%;
}

.tt24-textarea {
    resize: vertical; /* Allows the user to make the box taller, but not wider */
    min-height: 100px;
}

/* Focus State (When the user clicks inside the field) */
.tt24-input:focus,
.tt24-textarea:focus {
    border-color: var(--tt24-border-focus);
    box-shadow: 0 0 0 1px var(--tt24-border-focus);
    outline: none;
}

/* ==========================================================================
   5. The Submit Button
   ========================================================================== */
.tt24-submit-btn {
    background-color: var(--tt24-primary-color);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--tt24-border-radius);
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    align-self: flex-start; /* Keeps the button from stretching full width */
}

.tt24-submit-btn:hover {
    background-color: var(--tt24-primary-hover);
}

.tt24-submit-btn:active {
    transform: scale(0.98); /* Slight click effect */
}

.tt24-submit-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   6. AJAX Response Messages
   ========================================================================== */
.tt24-form-response {
    display: none; /* Hidden by default, toggled via JavaScript */
    margin-top: var(--tt24-spacing);
    padding: 12px 15px;
    border-radius: var(--tt24-border-radius);
    font-size: 0.95rem;
    line-height: 1.4;
    animation: tt24FadeInUp 0.4s ease forwards;
}

.tt24-form-response p {
    margin: 0;
    padding: 0;
}

.tt24-success {
    background-color: var(--tt24-success-bg);
    color: var(--tt24-success-text);
    border: 1px solid #c3e6cb;
}

.tt24-error {
    background-color: var(--tt24-error-bg);
    color: var(--tt24-error-text);
    border: 1px solid #f5c6cb;
}

/* Subtle animation for the response message */
@keyframes tt24FadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   7. Responsive Design (Mobile Devices)
   ========================================================================== */
@media screen and (max-width: 600px) {
    .tt24-submit-btn {
        width: 100%; /* Make the button full width on small screens for easier tapping */
    }
}