/*
 * Frontend styles for Code and Core Repeater Fields for Contact Form 7.
 * 
 * This file contains the layout and design for the repeater container,
 * rows, and various button styles (filled, outline, minimal, etc.).
 */

/* ==========================================================================
   Main Layout
   ========================================================================== */
.ccrf-repeater {
    margin-bottom: 20px;
}

.ccrf-repeater-row {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    position: relative;
}

/* ==========================================================================
   Action Buttons (Base)
   ========================================================================== */
.ccrf-repeater-remove {
    background: #ff4d4d;
    color: #fff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    margin-top: 10px;
}

.ccrf-repeater-remove:hover {
    background: #cc0000;
}

.ccrf-repeater-duplicate {
    background: #2196F3;
    color: #fff;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 3px;
    margin-top: 10px;
    margin-right: 5px;
}

.ccrf-repeater-duplicate:hover {
    background: #0b7dda;
}

.ccrf-repeater-add {
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 3px;
}

.ccrf-repeater-add:hover {
    background: #45a049;
}

/* ==========================================================================
   Icon Buttons
   ========================================================================== */
.ccrf-repeater-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.ccrf-repeater-add .ccrf-repeater-btn-icon svg,
.ccrf-repeater-remove .ccrf-repeater-btn-icon svg {
    stroke-width: 3px;
}

.ccrf-repeater-duplicate .ccrf-repeater-btn-icon svg {
    stroke-width: 2px;
}

/* ==========================================================================
   Button Variants
   ========================================================================== */

/* Filled (Default) */
.ccrf-repeater-btn-filled.ccrf-repeater-add {
    background: #4CAF50;
    color: #fff;
    border: none;
}

.ccrf-repeater-btn-filled.ccrf-repeater-add:hover {
    background: #45a049;
}

.ccrf-repeater-btn-filled.ccrf-repeater-remove {
    background: #ff4d4d;
    color: #fff;
    border: none;
}

.ccrf-repeater-btn-filled.ccrf-repeater-remove:hover {
    background: #cc0000;
}

.ccrf-repeater-btn-filled.ccrf-repeater-duplicate {
    background: #2196F3;
    color: #fff;
    border: none;
}

.ccrf-repeater-btn-filled.ccrf-repeater-duplicate:hover {
    background: #0b7dda;
}

/* Outline */
.ccrf-repeater-btn-outline.ccrf-repeater-add {
    background: transparent;
    color: #4CAF50;
    border: 2px solid #4CAF50;
    font-weight: 600;
}

.ccrf-repeater-btn-outline.ccrf-repeater-add:hover {
    background: #4CAF50;
    color: #fff;
}

.ccrf-repeater-btn-outline.ccrf-repeater-remove {
    background: transparent;
    color: #ff4d4d;
    border: 2px solid #ff4d4d;
    font-weight: 600;
}

.ccrf-repeater-btn-outline.ccrf-repeater-remove:hover {
    background: #ff4d4d;
    color: #fff;
}

.ccrf-repeater-btn-outline.ccrf-repeater-duplicate {
    background: transparent;
    color: #2196F3;
    border: 2px solid #2196F3;
    font-weight: 600;
}

.ccrf-repeater-btn-outline.ccrf-repeater-duplicate:hover {
    background: #2196F3;
    color: #fff;
}

/* Minimal */
.ccrf-repeater-btn-minimal.ccrf-repeater-add {
    background: transparent;
    color: #4CAF50;
    border: none;
    padding: 5px 0;
    text-decoration: underline;
}

.ccrf-repeater-btn-minimal.ccrf-repeater-add:hover {
    color: #45a049;
    background: transparent;
}

.ccrf-repeater-btn-minimal.ccrf-repeater-remove {
    background: transparent;
    color: #ff4d4d;
    border: none;
    padding: 5px 0;
    text-decoration: underline;
    margin-top: 5px;
}

.ccrf-repeater-btn-minimal.ccrf-repeater-remove:hover {
    color: #cc0000;
    background: transparent;
}

.ccrf-repeater-btn-minimal.ccrf-repeater-duplicate {
    background: transparent;
    color: #2196F3;
    border: none;
    padding: 5px 0;
    text-decoration: underline;
    margin-top: 5px;
    margin-right: 10px;
}

.ccrf-repeater-btn-minimal.ccrf-repeater-duplicate:hover {
    color: #0b7dda;
    background: transparent;
}

/* Block Style */
.ccrf-repeater-btn-block {
    display: block;
    width: 100%;
    margin-top: 10px;
}

.ccrf-repeater-btn-block.ccrf-repeater-add {
    background: #4CAF50;
    color: #fff;
    border: none;
    text-align: center;
}

.ccrf-repeater-btn-block.ccrf-repeater-remove {
    background: #ff4d4d;
    color: #fff;
    border: none;
    text-align: center;
}

.ccrf-repeater-btn-block.ccrf-repeater-duplicate {
    background: #2196F3;
    color: #fff;
    border: none;
    text-align: center;
}

.ccrf-repeater-btn-block.ccrf-repeater-duplicate:hover {
    background: #0b7dda;
}

/* ==========================================================================
   Drag & Drop Styles
   ========================================================================== */
.ccrf-repeater.ccrf-has-drag-drop .ccrf-repeater-row {
    padding-left: 40px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ccrf-repeater-drag-handle {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: grab;
    color: #888;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    user-select: none;
    z-index: 10;
}

.ccrf-repeater-drag-handle:active {
    cursor: grabbing;
}

.ccrf-repeater-drag-handle svg {
    display: block;
    width: 20px;
    height: 20px;
    transition: color 0.2s ease;
}

.ccrf-repeater-drag-handle:hover svg {
    color: #333;
}

/* Dragging State on the element itself */
.ccrf-repeater-row.ccrf-dragging {
    opacity: 0.4;
    border: 1px dashed #666 !important;
    background-color: #f1f1f1 !important;
}

/* Hover/Over state on valid drop target */
.ccrf-repeater-row.ccrf-drag-over {
    border-color: #4CAF50 !important;
    background-color: #e8f5e9 !important;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}
