/**
 * TurnCity Secure Forms - Frontend Styles
 */

/* Form Wrapper */
.tcsf-form-wrapper {
    max-width: 100%;
    margin: 0 auto 2em;
}

/* Messages */
.tcsf-message {
    padding: 1em;
    margin-bottom: 1.5em;
    border-radius: 4px;
    border-left: 4px solid;
}

.tcsf-message-success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.tcsf-message-error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.tcsf-error-list {
    margin: 0.5em 0 0 1.5em;
}

/* Form */
.tcsf-form {
    display: block;
}

/* Grid System for Side-by-Side Fields */
.tcsf-grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5em;
    width: 100%;
}

/* Column width classes - supports 1-12 columns */
.tcsf-col-1 { grid-column: span 1; }
.tcsf-col-2 { grid-column: span 2; }
.tcsf-col-3 { grid-column: span 3; }  /* 25% - Quarter */
.tcsf-col-4 { grid-column: span 4; }  /* 33% - Third */
.tcsf-col-5 { grid-column: span 5; }
.tcsf-col-6 { grid-column: span 6; }  /* 50% - Half */
.tcsf-col-7 { grid-column: span 7; }
.tcsf-col-8 { grid-column: span 8; }  /* 67% - Two Thirds */
.tcsf-col-9 { grid-column: span 9; }  /* 75% - Three Quarters */
.tcsf-col-10 { grid-column: span 10; }
.tcsf-col-11 { grid-column: span 11; }
.tcsf-col-12 { grid-column: span 12; } /* 100% - Full Width */

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .tcsf-grid-container {
        grid-template-columns: 1fr;
        gap: 1em;
    }
    .tcsf-col-1,
    .tcsf-col-2,
    .tcsf-col-3,
    .tcsf-col-4,
    .tcsf-col-5,
    .tcsf-col-6,
    .tcsf-col-7,
    .tcsf-col-8,
    .tcsf-col-9,
    .tcsf-col-10,
    .tcsf-col-11,
    .tcsf-col-12 {
        grid-column: span 1 !important;
    }
}

/* Tablet: Honor half-width fields */
@media (min-width: 769px) and (max-width: 1024px) {
    .tcsf-grid-container {
        gap: 1.25em;
    }
    .tcsf-col-1,
    .tcsf-col-2,
    .tcsf-col-3,
    .tcsf-col-4,
    .tcsf-col-5 {
        grid-column: span 6; /* Make smaller fields half-width on tablet */
    }
}

/* Field */
.tcsf-field {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    min-width: 0; /* Prevent grid overflow */
}

.tcsf-label {
    font-weight: 600;
    display: block;
}

.tcsf-required-indicator {
    color: #dc3545;
    margin-left: 0.25em;
}

.tcsf-description {
    font-size: 0.  875em;
    color: #666;
    display: block;
}

/* Input Fields */
.tcsf-input,
.tcsf-textarea,
.tcsf-select,
.tcsf-file {
    width: 100%;
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.2s;
}

.tcsf-input:focus,
.tcsf-textarea:focus,
.tcsf-select:focus,
.tcsf-file:focus {
    border-color: #007cba;
    outline: none;
}

.tcsf-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Radio & Checkbox */
.tcsf-radio-group,
.tcsf-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.tcsf-radio-label,
.tcsf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
}

.tcsf-radio,
.tcsf-checkbox {
    width: auto;
    margin: 0;
}

/* Name & Address Groups */
.tcsf-name-group,
.tcsf-address-group {
    display: grid;
    gap: 1em;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.tcsf-name-part,
.tcsf-address-part {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.tcsf-full-width {
    grid-column: 1 / -1;
}

/* Section */
.tcsf-section {
    padding: 1em 0;
    border-top: 2px solid #ddd;
    margin-top: 1em;
}

.tcsf-section-title {
    margin: 0 0 0.5em;
    font-size: 1.25em;
}

.tcsf-section-description {
    margin: 0;
    color: #666;
}

/* HTML Content */
.tcsf-html-content {
    padding: 1em;
    background-color: #f9f9f9;
    border-radius: 4px;
}

/* Submit Button */
.tcsf-submit-wrapper {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-top: 1em;
}

.tcsf-submit-button {
    padding: 0.75em 2em;
    background-color: #007cba;
    color: white !important;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tcsf-submit-button:hover {
    background-color: #005a87;
}

.tcsf-submit-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.tcsf-loading {
    color: #666;
}

/* Response Messages */
.tcsf-response {
    margin-top: 1em;
    padding: 1em;
    border-radius: 4px;
    display: none;
}

.tcsf-response.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.tcsf-response.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Error States */
.tcsf-field.has-error .tcsf-input,
.tcsf-field.has-error .tcsf-textarea,
.tcsf-field.has-error .tcsf-select {
    border-color: #dc3545;
}

.tcsf-error-message {
    color: #dc3545;
    font-size: 0.875em;
    display: none;
}

.tcsf-field.has-error .tcsf-error-message {
    display: block;
}

/* Hide required indicator by default, show only on validation error */
.tcsf-required-indicator {
    display: none;
    color: #dc3545;
    margin-left: 0.25em;
}

.tcsf-field.has-error .tcsf-required-indicator {
    display: inline;
}

/* Honeypot (hidden) */
.tcsf-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* hCaptcha Widget */
.tcsf-captcha-wrapper {
    margin: 1.5em 0;
}

.h-captcha {
    margin: 12px 0;
    transform-origin: 0 0;
}

/* Center hCaptcha on mobile */
@media (max-width: 480px) {
    .h-captcha {
        transform: scale(0.85);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .tcsf-name-group,
    .tcsf-address-group {
        grid-template-columns: 1fr;
    }
    
    .tcsf-submit-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
}
