/* 
 * PadniSi Design System - Forms
 * -----------------------------
 * Inputs, selects, and form controls.
 */

/* Form Groups */
.mb-3 {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--dark-light);
    font-size: 0.9rem;
}

/* Base Input Style */
.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--dark);
    background-color: white;
    background-clip: padding-box;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    font-family: inherit;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--secondary-dark);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* Textarea */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Select Custom Arrow */
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23334155' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 14px 10px;
    padding-right: 2.5rem;
}

/* Input Group */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray);
    background-color: var(--light);
    border: 1px solid var(--gray-light);
    white-space: nowrap;
}

/* Prepend: icon before input (.input-group-text + .form-control) */
.input-group-text:first-child {
    border-right: 0;
    border-radius: 6px 0 0 6px;
}

.input-group-text:first-child+.form-control {
    border-radius: 0 6px 6px 0;
}

/* Append: input before icon (.form-control + .input-group-text) */
.input-group .form-control:first-child {
    border-radius: 6px 0 0 6px;
}

.input-group-text:last-child {
    border-left: 0;
    border-radius: 0 6px 6px 0;
}

/* --- Custom Components --- */

/* Image Upload Controls */
.image-uploader-controls {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-bottom: 10px;
}

/* Image Upload Wrapper */
#image-upload-wrapper,
.image-upload-wrapper {
    background: #f8faff;
    border: 2px dotted #ccc;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s;
    position: relative;
    min-height: 180px;
    display: flex;
    flex-direction: column;
}

.image-upload-wrapper:hover {
    border-color: var(--secondary);
    background: #eef2ff;
}

/* Image List / Grid */
.image-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.image-item {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    overflow: hidden;
    background: white;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Tagify Overrides (if used) */
.tagify {
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    padding: 2px;
    --tags-focus-border-color: var(--secondary-dark);
    min-height: 38px;
}

/* --- Responsive Characteristics Form --- */

/* Mobile First (Card Layout) */
.properties-header {
    display: none !important;
    /* Hide column headers on mobile */
}

/*
   Grid Layout Strategy:
   Row 1: [ Key Input (1fr) ] [ Delete Button (auto) ]
   Row 2: [ Value Input (Span All)               ]
*/
.property-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 15px;
    align-items: center;
    /* Vertically center items in their cells */
}

.property-col-key {
    grid-column: 1 / 2;
    grid-row: 1;
    width: 100%;
}

.property-actions {
    grid-column: 2 / 3;
    grid-row: 1;
    position: static;
    /* Reset absolute */
    display: flex;
    justify-content: flex-end;
}

.property-col-value {
    grid-column: 1 / -1;
    /* Span full width */
    grid-row: 2;
    width: 100%;
}

.remove-property {
    /* Make button slightly more visible/touchable on mobile card */
    background: white;
    border: 1px solid #dee2e6;
    color: var(--danger);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* Tablet & Desktop (Row Layout) */
@media (min-width: 768px) {
    .properties-header {
        display: flex;
        gap: 10px;
        margin-bottom: 5px;
    }

    .property-row {
        display: flex;
        gap: 10px;
        align-items: flex-start;
        padding: 0;
        background: transparent;
        border: none;
        margin-bottom: 5px;
    }

    /* Reset Grid Properties for Flex Layout */
    .property-col-key,
    .property-col-value,
    .property-actions {
        grid-column: auto;
        grid-row: auto;
        width: auto;
    }

    .property-col-key {
        flex: 1;
    }

    .property-col-value {
        flex: 1;
    }

    .remove-property {
        height: 31px;
        /* Match input-sm height */
        width: 31px;
        background: transparent;
        border: 1px solid transparent;
        /* Reset border */
        color: var(--danger);
        /* Keep danger color */
    }

    .remove-property:hover {
        border-color: var(--danger);
        background: rgba(220, 53, 69, 0.1);
    }
}

/* Form Actions (Buttons) */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
    /* Left align */
}

.form-actions .btn {
    width: auto;
    /* Natural width */
    min-width: 120px;
    /* Safe minimum for touch targets */
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
