/* W4S Match Frontend Editor Styles */

.w4s-hidden {
    display: none !important;
}

/* Field Wrapper Styles */
.w4s-field-wrapper {
    position: relative;
    margin: 10px 0;
    padding: 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.w4s-field-wrapper:hover {
    background-color: #f8f9fa;
}

.w4s-field-wrapper.w4s-editable {
    cursor: pointer;
    border: 2px dashed transparent;
}

.w4s-field-wrapper.w4s-editable:hover {
    border-color: #007cba;
    background-color: #e7f3ff;
}

.w4s-field-wrapper.w4s-readonly {
    background-color: #f1f1f1;
    opacity: 0.8;
}

.w4s-field-wrapper.w4s-readonly:hover {
    background-color: #e8e8e8;
}

/* Edit/Readonly Indicators */
.w4s-edit-indicator,
.w4s-readonly-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.w4s-field-wrapper:hover .w4s-edit-indicator,
.w4s-field-wrapper:hover .w4s-readonly-indicator {
    opacity: 1;
}

.w4s-edit-indicator {
    background: #007cba;
}

.w4s-readonly-indicator {
    background: #dc3545;
}

/* Modal Overlay */
#w4s-match-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.w4s-editor-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
}

.w4s-editor-header {
    background: #007cba;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.w4s-editor-header h3 {
    margin: 0;
    font-size: 18px;
}

.w4s-close-editor {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.w4s-close-editor:hover {
    background: rgba(255, 255, 255, 0.2);
}

.w4s-editor-body {
    padding: 20px;
}

.w4s-field-info {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
}

.w4s-editor-content {
    margin-bottom: 20px;
}

#w4s-field-editor {
    width: 100%;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 200px;
    background-color: white !important;
    color: #333 !important;
}

#w4s-field-editor:focus {
    outline: none;
    border-color: #007cba;
}

.w4s-editor-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Buttons */
.w4s-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
}

.w4s-btn-primary {
    background: #007cba;
    color: white;
}

.w4s-btn-primary:hover {
    background: #005a87;
}

.w4s-btn-secondary {
    background: #6c757d;
    color: white;
}

.w4s-btn-secondary:hover {
    background: #545b62;
}

.w4s-btn-ai {
    background: #28a745;
    color: white;
}

.w4s-btn-ai:hover {
    background: #218838;
}

.w4s-btn-small {
    padding: 5px 12px;
    font-size: 12px;
}

.w4s-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toolbar */
#w4s-editor-toolbar {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    min-width: 200px;
}

.w4s-toolbar-content {
    padding: 15px;
}

.w4s-toolbar-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    display: block;
    margin-bottom: 10px;
}

.w4s-toolbar-actions {
    display: flex;
    gap: 8px;
}

/* Edit Mode Active */
.w4s-edit-mode-active .w4s-field-wrapper.w4s-editable {
    border-color: #007cba;
    background-color: #e7f3ff;
}

.w4s-edit-mode-active .w4s-edit-indicator {
    opacity: 1;
}

/* Success/Error Messages */
.w4s-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 4px;
    color: white;
    z-index: 999999;
    animation: slideInRight 0.3s ease;
}

.w4s-message.w4s-success {
    background: #28a745;
}

.w4s-message.w4s-error {
    background: #dc3545;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .w4s-editor-modal {
        width: 95%;
        max-height: 90vh;
    }
    
    .w4s-editor-actions {
        flex-direction: column;
    }
    
    .w4s-btn {
        width: 100%;
    }
    
    #w4s-editor-toolbar {
        right: 10px;
        min-width: 150px;
    }
    
    .w4s-toolbar-content {
        padding: 10px;
    }
}

/* Loading State */
.w4s-loading {
    position: relative;
    pointer-events: none;
}

.w4s-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Gallery Field Specific */
.w4s-field-wrapper[data-field="fotogalerie"] .w4s-field-content,
.w4s-field-wrapper[data-field="videogalerie"] .w4s-field-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.w4s-field-wrapper[data-field="fotogalerie"] .w4s-field-content img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}

/* Report Field Specific */
.w4s-field-wrapper[data-field="post_report"] .w4s-field-content {
    min-height: 100px;
    line-height: 1.6;
}

.w4s-field-wrapper[data-field="post_report"]:empty .w4s-field-content::before {
    content: "Kliknutím přidáte reportáž zápasu...";
    color: #999;
    font-style: italic;
}