/**
 * Frontend Styles - CPT Form Display Plugin
 * Minimal styling that inherits from theme
 */

/* ============================================
   FORM STYLES
   ============================================ */

.spl-form-wrapper {
    max-width: 600px;
}

.spl-form-field {
    margin-bottom: 1.5em;
}

.spl-form-field label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.spl-form-field input[type="text"],
.spl-form-field input[type="email"],
.spl-form-field input[type="url"],
.spl-form-field input[type="number"],
.spl-form-field input[type="date"],
.spl-form-field textarea {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}

.spl-form-field input:focus,
.spl-form-field textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.spl-required {
    color: #d63638;
    margin-left: 0.25em;
}

.spl-submit-btn {
    display: inline-block;
    padding: 0.75em 2em;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.spl-submit-btn:hover {
    background: #005a87;
}

.spl-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.spl-form-message {
    margin-top: 1em;
    padding: 1em;
    border-radius: 4px;
}

.spl-form-message.spl-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.spl-form-message.spl-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* ============================================
   ACCORDION STYLES
   ============================================ */

.spl-accordion-wrapper {
    max-width: 800px;
}

.spl-accordion-item {
    border: 1px solid #e0e0e0;
    margin-bottom: -1px;
}

.spl-accordion-item:first-child {
    border-radius: 4px 4px 0 0;
}

.spl-accordion-item:last-child {
    border-radius: 0 0 4px 4px;
    margin-bottom: 0;
}

.spl-accordion-item:only-child {
    border-radius: 4px;
}

.spl-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1em 1.25em;
    background: var(--spl-header-bg, #fafafa);
    color: var(--spl-title-color, #333);
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 1em;
    font-family: inherit;
    transition: background-color 0.2s ease;
}

.spl-accordion-header:hover {
    opacity: 0.92;
}

.spl-accordion-header[aria-expanded="true"] {
    border-bottom: 1px solid #e0e0e0;
}

.spl-accordion-title {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.spl-header-line1 {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--spl-title-color, #333);
}

.spl-header-line2 {
    font-size: 0.9em;
    margin-top: 2px;
    color: var(--spl-secondary-color, #333);
    font-weight: 400;
}

.spl-accordion-icon {
    flex-shrink: 0;
    margin-left: 1em;
    transition: transform 0.2s ease;
}

.spl-accordion-header[aria-expanded="true"] .spl-accordion-icon {
    transform: rotate(180deg);
}

.spl-accordion-content {
    background: #fff;
}

.spl-accordion-body {
    padding: 1.25em;
}

/* Field list in accordion */
.spl-field-list {
    margin: 0;
    padding: 0;
}

.spl-field-item {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75em 0;
    border-bottom: 1px solid #f0f0f0;
}

.spl-field-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.spl-field-item:first-child {
    padding-top: 0;
}

.spl-field-item dt {
    flex: 0 0 200px;
    font-weight: 600;
    color: #555;
    margin: 0;
}

.spl-field-item dd {
    flex: 1;
    margin: 0;
    min-width: 200px;
}

.spl-field-item dd a {
    word-break: break-all;
}

/* ============================================
   ERROR & NO RESULTS
   ============================================ */

.spl-error {
    padding: 1em;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 4px;
}

.spl-no-results {
    padding: 2em;
    text-align: center;
    color: #666;
    background: #f9f9f9;
    border-radius: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    .spl-field-item {
        flex-direction: column;
    }

    .spl-field-item dt {
        flex: none;
        margin-bottom: 0.25em;
    }

    .spl-field-item dd {
        min-width: 0;
    }

    .spl-controls-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FILE UPLOAD & DOWNLOAD
   ============================================ */

.spl-form-field input[type="file"] {
    padding: 0.5em;
    border: 2px dashed #ccc;
    border-radius: 4px;
    background: #fafafa;
    width: 100%;
    cursor: pointer;
}

.spl-form-field input[type="file"]:hover {
    border-color: #0073aa;
    background: #f0f6fc;
}

.spl-field-description {
    margin-top: 0.5em;
    font-size: 0.85em;
    color: #666;
}

.spl-file-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.5em 1em;
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    text-decoration: none;
    color: #0073aa;
    transition: all 0.2s ease;
}

.spl-file-download:hover {
    background: #e5f0f8;
    border-color: #0073aa;
    color: #005a87;
}

.spl-file-icon {
    font-size: 1.2em;
}

.spl-file-meta {
    font-size: 0.85em;
    color: #666;
}

/* ============================================
   DISPLAY CONTROLS (Filter/Search/Sort)
   ============================================ */

.spl-display-controls {
    margin-bottom: 1em;
    max-width: 800px;
}

.spl-search-wrapper {
    margin-bottom: 0.75em;
}

.spl-search-input {
    width: 100%;
    padding: 0.6em 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}

.spl-search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Controls grid */
.spl-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75em;
}

.spl-control-item select {
    width: 100%;
    padding: 0.6em 2em 0.6em 0.75em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75em center;
}

.spl-control-item select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Show more button */
.spl-show-more-btn {
    width: 100%;
    padding: 0.75em;
    background: var(--spl-show-more-bg, #1a3a5c);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    cursor: pointer;
    margin-top: 0.5em;
    transition: opacity 0.2s ease;
}

.spl-show-more-btn:hover {
    opacity: 0.9;
}

/* Pinned item indicator */
.spl-pinned-item {
    border-left: 3px solid var(--spl-header-bg, #F5A623);
}

/* Dropdown field in form */
.spl-form-field select {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    background: #fff;
}

.spl-form-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

