/* assets/css/frontend.css */

/* Base Styles */
.sfbp-search-form {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0 auto;
    max-width: 100%;
    box-sizing: border-box;
}

.sfbp-search-form * {
    box-sizing: border-box;
}

/* Layout Variations */
.sfbp-layout-vertical .sfbp-field {
    margin-bottom: 20px;
}

.sfbp-layout-horizontal {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
}

.sfbp-layout-horizontal .sfbp-field {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.sfbp-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.sfbp-layout-inline {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Field Styles */
.sfbp-field {
    position: relative;
}

.sfbp-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.sfbp-field-required label::after {
    content: '*';
    color: #dc3232;
    margin-left: 3px;
}

.sfbp-field input[type="text"],
.sfbp-field input[type="email"],
.sfbp-field input[type="url"],
.sfbp-field input[type="number"],
.sfbp-field input[type="date"],
.sfbp-field input[type="time"],
.sfbp-field input[type="search"],
.sfbp-field select,
.sfbp-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
    background: #fff;
}

.sfbp-field input:focus,
.sfbp-field select:focus,
.sfbp-field textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.sfbp-field-description {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    display: block;
}

/* Button Styles */
.sfbp-submit-button,
.sfbp-reset-button {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 10px;
}

.sfbp-button-primary {
    background-color: #007cba;
    border-color: #007cba;
    color: #fff;
}

.sfbp-button-primary:hover {
    background-color: #005a87;
    border-color: #005a87;
}

.sfbp-button-secondary {
    background-color: #f0f0f1;
    border-color: #8c8f94;
    color: #2c3338;
}

.sfbp-button-secondary:hover {
    background-color: #dcdcde;
    border-color: #787c82;
}

.sfbp-button-success {
    background-color: #00a32a;
    border-color: #00a32a;
    color: #fff;
}

.sfbp-button-success:hover {
    background-color: #007017;
    border-color: #007017;
}

.sfbp-button-danger {
    background-color: #d63638;
    border-color: #d63638;
    color: #fff;
}

.sfbp-button-danger:hover {
    background-color: #b32d2e;
    border-color: #b32d2e;
}

/* Validation Styles */
.sfbp-field-error input,
.sfbp-field-error select,
.sfbp-field-error textarea {
    border-color: #d63638;
}

.sfbp-field-error input:focus,
.sfbp-field-error select:focus,
.sfbp-field-error textarea:focus {
    box-shadow: 0 0 0 1px #d63638;
}

.sfbp-error-message {
    color: #d63638;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Loading State */
.sfbp-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.sfbp-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: sfbp-spin 1s linear infinite;
}

@keyframes sfbp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Conditional Logic */
.sfbp-conditional-hidden {
    display: none !important;
}

.sfbp-conditional-disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Results Display */
.sfbp-results-container {
    margin-top: 30px;
}

.sfbp-results-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.sfbp-results-count {
    font-size: 14px;
    color: #666;
}

.sfbp-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* Grid Layout */
.sfbp-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.sfbp-result-item {
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.sfbp-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* List Layout */
.sfbp-results-list .sfbp-result-item {
    display: flex;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

/* Table Layout */
.sfbp-results-table {
    width: 100%;
    border-collapse: collapse;
}

.sfbp-results-table th,
.sfbp-results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.sfbp-results-table th {
    background-color: #f9f9f9;
    font-weight: 600;
}

/* Pagination */
.sfbp-pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.sfbp-pagination a,
.sfbp-pagination span {
    display: inline-block;
    padding: 6px 12px;
    margin: 0 3px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #007cba;
}

.sfbp-pagination .current {
    background-color: #007cba;
    border-color: #007cba;
    color: #fff;
}

.sfbp-pagination a:hover {
    background-color: #f0f0f1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sfbp-layout-horizontal {
        flex-direction: column;
    }
    
    .sfbp-layout-horizontal .sfbp-field {
        width: 100%;
    }
    
    .sfbp-layout-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sfbp-results-grid {
        grid-template-columns: 1fr;
    }
    
    .sfbp-results-list .sfbp-result-item {
        flex-direction: column;
    }
    
    .sfbp-results-table {
        display: block;
        overflow-x: auto;
    }
}

/* Theme: Default */
.sfbp-theme-default .sfbp-field input,
.sfbp-theme-default .sfbp-field select,
.sfbp-theme-default .sfbp-field textarea {
    background: #fff;
    border-color: #8c8f94;
}

.sfbp-theme-default .sfbp-submit-button {
    background: #2271b1;
    color: #fff;
}

/* Theme: Modern */
.sfbp-theme-modern .sfbp-field input,
.sfbp-theme-modern .sfbp-field select,
.sfbp-theme-modern .sfbp-field textarea {
    background: #f8f9fa;
    border: none;
    border-bottom: 2px solid #dee2e6;
    border-radius: 0;
    padding: 12px 0;
}

.sfbp-theme-modern .sfbp-field input:focus,
.sfbp-theme-modern .sfbp-field select:focus,
.sfbp-theme-modern .sfbp-field textarea:focus {
    border-bottom-color: #007cba;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sfbp-theme-modern .sfbp-submit-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
}

/* Theme: Dark */
.sfbp-theme-dark {
    background: #1a1d21;
    padding: 20px;
    border-radius: 8px;
}

.sfbp-theme-dark .sfbp-field label {
    color: #e0e1e3;
}

.sfbp-theme-dark .sfbp-field input,
.sfbp-theme-dark .sfbp-field select,
.sfbp-theme-dark .sfbp-field textarea {
    background: #2c3036;
    border-color: #40454d;
    color: #e0e1e3;
}

.sfbp-theme-dark .sfbp-field input:focus,
.sfbp-theme-dark .sfbp-field select:focus,
.sfbp-theme-dark .sfbp-field textarea:focus {
    border-color: #007cba;
    background: #363b43;
}

.sfbp-theme-dark .sfbp-submit-button {
    background: #007cba;
    color: #fff;
}

/* Theme: Classic */
.sfbp-theme-classic .sfbp-field input,
.sfbp-theme-classic .sfbp-field select,
.sfbp-theme-classic .sfbp-field textarea {
    background: #fff;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
}

.sfbp-theme-classic .sfbp-submit-button {
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    padding: 12px 24px;
    font-weight: 600;
}

/* Theme: Bootstrap */
.sfbp-theme-bootstrap .sfbp-field input,
.sfbp-theme-bootstrap .sfbp-field select,
.sfbp-theme-bootstrap .sfbp-field textarea {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.sfbp-theme-bootstrap .sfbp-submit-button {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
}

/* Animation */
@keyframes sfbp-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sfbp-search-form,
.sfbp-result-item {
    animation: sfbp-fadeIn 0.3s ease;
}

/* Accessibility */
.sfbp-search-form input:focus,
.sfbp-search-form select:focus,
.sfbp-search-form textarea:focus,
.sfbp-search-form button:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.sfbp-search-form .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Print Styles */
@media print {
    .sfbp-search-form {
        display: none;
    }
    
    .sfbp-results-container {
        margin-top: 0;
    }
}