/* DESCRIPTION: Styles for the WPUF repeat field component (blocks and rows display modes). */

.wpuf-fields.wpuf-repeat-container {
    margin-top: 2rem;
}

.wpuf-fields.wpuf-repeat-container li {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.wpuf-repeat-instance li {
    margin-bottom: 0 !important;
}

.wpuf-repeat-controls {
    margin-left: 5px;
    margin-top: 10px;
}

.wpuf-repeat-controls:last-child {
    margin-bottom: 1rem;
}

.wpuf-repeat-controls button {
    border: 1px solid #ccc !important;
    background: #fff;
    padding: 2px 8px;
    margin-left: 5px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.wpuf-repeat-controls button:hover {
    background: #f0f0f0;
    cursor: pointer;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Smooth transition effects for repeat instances */
.wpuf-repeat-instance {
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.wpuf-repeat-instance.wpuf-adding {
    opacity: 0;
    transform: translateY(-10px);
}

.wpuf-repeat-instance.wpuf-removing {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Smooth transitions for buttons */
.wpuf-repeat-controls button {
    transition: all 0.2s ease;
}

.wpuf-repeat-controls button:active {
    transform: translateY(1px);
}

/* Styles for rows display mode */
.wpuf-repeat-display-rows .wpuf-repeat-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
    border: none;
}

.wpuf-repeat-display-rows .wpuf-repeat-table th,
.wpuf-repeat-display-rows .wpuf-repeat-table td {
    border: none;
    padding: 0;
    text-align: left;
    vertical-align: top;
    background: transparent;
}

.wpuf-repeat-display-rows .wpuf-repeat-table th {
    background: transparent;
    font-weight: bold;
}

.wpuf-repeat-display-rows .wpuf-repeat-table .wpuf-label {
    display: none !important; /* Hide individual field labels in row mode */
}

.wpuf-repeat-display-rows .wpuf-fields input[type="text"] {
    vertical-align: top !important;
}

.wpuf-repeat-display-rows .wpuf-repeat-controls {
    margin: 0;
    text-align: center;
    vertical-align: middle;
}

.wpuf-repeat-display-rows .wpuf-repeat-controls button {
    margin: 0 2px;
    padding: 4px 8px;
    min-width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.wpuf-repeat-display-rows .wpuf-repeat-instance {
    display: table-row;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.wpuf-repeat-display-rows .wpuf-repeat-instance.wpuf-adding {
    opacity: 0;
    transform: translateY(-10px);
}

.wpuf-repeat-display-rows .wpuf-repeat-instance.wpuf-removing {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* Enhanced transitions for rows display */
.wpuf-repeat-display-rows .wpuf-repeat-table tbody tr {
    transition: all 0.3s ease;
}

.wpuf-repeat-display-rows .wpuf-repeat-table tbody tr.wpuf-adding {
    opacity: 0;
    transform: translateY(-10px);
}

.wpuf-repeat-display-rows .wpuf-repeat-table tbody tr.wpuf-removing {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    overflow: hidden;
}

.wpuf-repeat-display-rows .wpuf-repeat-table td li {
    padding-top: 0 !important;
    padding-left: 0 !important;
    margin: 0 !important;
    border: none !important;
}

.wpuf-repeat-display-rows .wpuf-repeat-table td .wpuf-fields {
    margin: 0 !important;
}

.wpuf-repeat-display-rows .wpuf-repeat-table td .wpuf-fields input,
.wpuf-repeat-display-rows .wpuf-repeat-table td .wpuf-fields textarea,
.wpuf-repeat-display-rows .wpuf-repeat-table td .wpuf-fields select {
    width: 100%;
    margin: 0 !important;
    transition: all 0.2s ease;
}

.wpuf-repeat-display-rows .wpuf-repeat-table td .wpuf-fields input:focus,
.wpuf-repeat-display-rows .wpuf-repeat-table td .wpuf-fields textarea:focus,
.wpuf-repeat-display-rows .wpuf-repeat-table td .wpuf-fields select:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}
