/**
 * Bilbil Formularz - Frontend Styles
 * Style wspólne dla wszystkich elementów formularza
 */

/* Container */
.bform-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
}

/* Form */
.bform-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Labels */
.bform-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1e1e1e;
    font-size: 14px;
}

.bform-required {
    color: #dc3232;
    margin-left: 2px;
}

/* Inputs */
.bform-input,
.bform-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
    box-sizing: border-box;
}

.bform-input:focus,
.bform-textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.bform-input.bform-error,
.bform-textarea.bform-error {
    border-color: #dc3232;
    box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.1);
}

.bform-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Messages */
.bform-message {
    padding: 15px 20px;
    border-radius: 6px;
    font-weight: 500;
    margin-top: 20px;
}

.bform-message.bform-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.bform-message.bform-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

/* Loading state */
.bform-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Responsive Grid for fields */
.bform-form > .bform-field {
    flex-shrink: 0;
}

/* Two columns on desktop */
@media screen and (min-width: 768px) {
    .bform-form {
        flex-wrap: wrap;
        flex-direction: row;
    }

    .bform-field {
        flex: 1 1 100%;
    }

    .bform-field[style*="width: 50%"] {
        flex: 0 0 calc(50% - 10px);
    }

    .bform-field[style*="width: 33%"] {
        flex: 0 0 calc(33.333% - 14px);
    }

    .bform-textarea-field,
    .bform-material-picker,
    .bform-single-choice,
    .bform-multiple-choice,
    .bform-submit-wrapper {
        flex: 1 1 100%;
    }
}

/* Mobile */
@media screen and (max-width: 767px) {
    .bform-container {
        padding: 20px 15px;
    }

    .bform-field[style*="width: 50%"],
    .bform-field[style*="width: 33%"] {
        width: 100% !important;
    }

    .bform-materials-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }

    .bform-material-visual {
        min-width: 140px;
        max-width: 100%;
    }

    .bform-choice-horizontal .bform-options {
        flex-direction: column;
    }

    .bform-submit-btn {
        width: 100%;
    }
}

/* Form Sections / Accordion */
.bform-section {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.bform-section-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    border: none;
    background-color: #f5f5f5;
    cursor: pointer;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    transition: background-color 0.2s ease;
}

.bform-section-header:hover {
    filter: brightness(0.95);
}

.bform-section-header:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

.bform-section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.bform-section-icon svg {
    width: 20px;
    height: 20px;
}

.bform-section-open .bform-section-icon {
    transform: rotate(0deg);
}

.bform-section:not(.bform-section-open) .bform-section-icon {
    transform: rotate(-90deg);
}

.bform-section-title {
    flex: 1;
}

.bform-section-content {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #eee;
}

/* Print styles */
@media print {
    .bform-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .bform-submit-wrapper {
        display: none;
    }

    .bform-section-header {
        pointer-events: none;
    }

    .bform-section-content {
        display: block !important;
    }
}
