/* Ricerca Diario Storico - Stili CSS */

.rds-search-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* Form Styles */
.rds-form {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    margin-bottom: 30px;
}

.rds-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.rds-form-row:last-child {
    margin-bottom: 0;
}

.rds-form-group {
    display: flex;
    flex-direction: column;
}

.rds-form-group.rds-full-width {
    flex: 1 1 100%;
}

.rds-form-group.rds-half-width {
    flex: 1 1 calc(50% - 10px);
}

.rds-form-group.rds-buttons {
    flex: 1 1 100%;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.rds-form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.rds-form-group input[type="text"],
.rds-form-group input[type="date"],
.rds-form-group select {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.rds-form-group input:focus,
.rds-form-group select:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
    outline: none;
}

/* Select Autocomplete Styling */
.rds-select-autocomplete {
    position: relative;
}

/* Buttons */
.rds-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
}

.rds-btn-primary {
    background: #0073aa;
    color: white;
}

.rds-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.rds-btn-secondary {
    background: #666;
    color: white;
}

.rds-btn-secondary:hover {
    background: #555;
}

.rds-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.rds-loading {
    margin-left: 10px;
}

/* Results Styles */
.rds-results {
    margin-top: 30px;
}

.rds-results-header {
    background: #f0f0f0;
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #333;
    border-left: 4px solid #0073aa;
}

.rds-results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rds-result-item {
    background: white;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease;
}

.rds-result-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.rds-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.rds-result-title {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-weight: 700;
    flex: 1;
}

.rds-result-date {
    background: #0073aa;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.rds-result-content {
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
    font-size: 15px;
}

.rds-result-content p {
    margin-bottom: 15px;
}

.rds-result-content p:last-child {
    margin-bottom: 0;
}

.rds-result-meta {
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.rds-result-persone,
.rds-result-luoghi {
    font-size: 13px;
    color: #666;
}

.rds-result-persone strong,
.rds-result-luoghi strong {
    color: #333;
    margin-right: 5px;
}

/* No Results */
.rds-no-results {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
    font-style: italic;
    border: 2px dashed #ddd;
}

/* Pagination */
.rds-pagination {
    margin-top: 30px;
}

.rds-pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.rds-page-btn {
    padding: 10px 15px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.rds-page-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.rds-page-btn.rds-current {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.rds-pagination-dots {
    padding: 10px 5px;
    color: #999;
    font-weight: bold;
}

/* Loading State */
.rds-form.rds-loading {
    opacity: 0.7;
    pointer-events: none;
}

.rds-results.rds-loading {
    opacity: 0.5;
    position: relative;
}

.rds-results.rds-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .rds-form {
        padding: 20px;
    }
    
    .rds-form-row {
        gap: 15px;
    }
    
    .rds-form-group.rds-half-width {
        flex: 1 1 100%;
    }
    
    .rds-form-group.rds-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rds-btn {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .rds-result-item {
        padding: 20px;
    }
    
    .rds-result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .rds-result-title {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .rds-result-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .rds-pagination-wrapper {
        gap: 3px;
    }
    
    .rds-page-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .rds-form {
        padding: 15px;
    }
    
    .rds-result-item {
        padding: 15px;
    }
    
    .rds-result-title {
        font-size: 16px;
    }
    
    .rds-result-content {
        font-size: 14px;
    }
    
    .rds-page-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 30px;
    }
}

/* Accessibilità */
.rds-btn:focus,
.rds-page-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Evidenziazione risultati ricerca */
.rds-highlight {
    background-color: #ffff99;
    font-weight: bold;
    padding: 1px 2px;
    border-radius: 2px;
}

/* Stili per select2 quando implementato */
.select2-container--default .select2-selection--single {
    height: 45px !important;
    border: 2px solid #ddd !important;
    border-radius: 5px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 41px !important;
    padding-left: 15px !important;
    color: #333 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 41px !important;
    right: 15px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #0073aa !important;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1) !important;
}

.select2-dropdown {
    border: 2px solid #0073aa !important;
    border-top: none !important;
    border-radius: 0 0 5px 5px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #0073aa !important;
}

/* Messaggi di stato */
.rds-message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: 500;
}

.rds-message.rds-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.rds-message.rds-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.rds-message.rds-info {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

/* Animazioni */
.rds-fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.rds-slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}