/**
 * reBB - Form Builder Styles
 */

/* Builder layout */
#content-wrapper {
    padding: 20px;
    flex: 1;
}

#button-container { 
    margin-top: 20px; 
    text-align: center; 
}

#template-container { 
    margin-top: 20px; 
}

#wildcard-container { 
    margin-bottom: 10px; 
}

#wildcard-list { 
    display: inline-block; 
}

#success-message { 
    margin-top: 20px; 
    display: none; 
}

#shareable-link { 
    word-break: break-all; 
    display: inline-block; 
    margin: 10px 0; 
}

#form-name-container {
    margin-top: 20px;
}

#documentation-link {
    margin-top: 15px;
}

/* Wildcard styling */
.wildcard {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    margin-bottom: 8px;
    padding: 5px 10px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
}

/* Copy button styling */
.copy-btn {
    margin-left: 6px;
    background: none;
    border: none;
    color: #6c757d;
    padding: 2px 5px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 0.85em;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

/* Used wildcard styling */
.wildcard-used {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
    text-decoration: line-through;
}

.wildcard-used .copy-btn {
    color: #155724;
}

.wildcard-used .copy-btn:hover {
    color: #0b2e13;
    background-color: rgba(21, 87, 36, 0.1);
}

/* Danger styling for unused dataset wildcards */
.wildcard-danger {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
    border-width: 2px;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    font-weight: bold;
}

/* Copy button styling within danger wildcards */
.wildcard-danger .copy-btn {
    color: #721c24;
}

.wildcard-danger .copy-btn:hover {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    #button-container {
        flex-direction: column;
    }
    
    .wildcard {
        margin-bottom: 10px;
    }
    
    #formio-builder-form {
        overflow-x: auto;
    }
}

/* Form style selector styles */
.form-style-options {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.style-option {
    position: relative;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.style-option:hover {
    background-color: #f8f9fa;
}

.style-option .form-check-input {
    margin-right: 8px;
}

.style-option .form-check-input:checked + .form-check-label {
    font-weight: bold;
    color: #007bff;
}

.style-option:has(.form-check-input:checked) {
    border-color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

/* Tooltip styles */
.style-tooltip {
    display: inline-block;
    position: relative;
    margin-left: 8px;
    cursor: help;
}

.style-tooltip i {
    color: #6c757d;
    transition: color 0.2s ease;
}

.style-tooltip:hover i {
    color: #007bff;
}

.tooltip-content {
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    min-width: 300px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.style-tooltip:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 15px);
}

.tooltip-content p {
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.tooltip-image {
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #eee;
    max-width: 100%;
}

.tooltip-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 220px;
    object-fit: contain;
}

/* Dark mode support */
body.dark-mode .style-option {
    border-color: #444;
}

body.dark-mode .style-option:hover {
    background-color: #2d2d2d;
}

body.dark-mode .tooltip-content {
    background-color: #2d2d2d;
    border-color: #444;
}

body.dark-mode .tooltip-image {
    border-color: #444;
}

/* Responsive tooltip adjustments */
@media (max-width: 768px) {
    .tooltip-content {
        min-width: 250px;
        max-width: 90vw;
        left: 0;
        transform: none;
    }
    
    .style-tooltip:hover .tooltip-content {
        bottom: calc(100% + 10px);
    }
    
    .tooltip-image img {
        max-height: 180px;
    }
}

/* Responsive tooltip adjustments */
@media (max-width: 768px) {
    .tooltip-content {
        min-width: 250px;
        max-width: 90vw;
        left: 0;
        transform: none;
    }
    
    .style-tooltip:hover .tooltip-content {
        bottom: calc(100% + 10px);
    }
    
    .tooltip-image img {
        max-height: 180px;
    }
}