/* ================================================
   Domstol Sök Rättspraxis - Complete Stylesheet
   ================================================ */

/* Container */
.domstol-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Search Form */
.domstol-search-form {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.domstol-search-form h2 {
    margin-top: 0;
    color: #000;
    font-size: 28px;
    margin-bottom: 10px;
}

.domstol-search-form .description {
    color: #666;
    margin-bottom: 20px;
    font-size: 14px;
}

.domstol-search-input {
    margin-bottom: 20px;
}

.domstol-search-input label,
.domstol-filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.domstol-search-input input[type="text"],
.domstol-search-form select,
.domstol-search-form input[type="date"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.domstol-search-input input[type="text"]:focus,
.domstol-search-form select:focus,
.domstol-search-form input[type="date"]:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}

.domstol-search-input small {
    display: block;
    margin-top: 6px;
    color: #666;
    font-size: 13px;
}

.domstol-search-form button[type="submit"] {
    background-color: #000000;
    font-size: 12px;
    font-weight: 500;
    border-radius: 10px 10px 10px 10px;
    padding: 13px 30px 13px 30px;
    color: #fff;
    border: none;
}

.domstol-search-form button[type="submit"]:hover {
    background: #004080;
    transform: translateY(-1px);
}

.domstol-search-form button[type="submit"]:active {
    transform: translateY(0);
}

/* Filters */
.domstol-filters {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #ddd;
}

.domstol-filter-group {
    margin-bottom: 20px;
}

.domstol-filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Advanced Filters Toggle */
.domstol-advanced-toggle {
    display: inline-block;
    margin-top: 15px;
    color: #000;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: color 0.3s;
}

.domstol-advanced-toggle:hover {
    color: #004080;
    text-decoration: underline;
}

.domstol-advanced-toggle::before {
    content: '▶ ';
    display: inline-block;
    transition: transform 0.3s;
}

.domstol-advanced-toggle.active::before {
    transform: rotate(90deg);
}

.domstol-advanced-filters {
    display: none;
    margin-top: 20px;
    padding: 25px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
}

.domstol-advanced-filters.active {
    display: block;
}

/* Results Section */
.domstol-results-header {
    margin: 30px 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 3px solid #000;
}

.domstol-results-header h3 {
    margin: 0;
    color: #000;
    font-size: 24px;
}

.domstol-results-count {
    color: #666;
    font-size: 16px;
    margin-top: 8px;
}

.domstol-results {
    margin-top: 20px;
}

/* Result Items */
.domstol-result-item {
    background: white;
    padding: 25px;
    margin-bottom: 20px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s, border-color 0.3s;
}

.domstol-result-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border-color: #000;
}

.domstol-result-item h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #000;
    font-size: 20px;
    line-height: 1.4;
}

.domstol-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.domstol-result-meta span {
    display: inline-flex;
    align-items: center;
}

.domstol-result-meta strong {
    color: #333;
    margin-right: 5px;
}

.domstol-result-summary {
    margin: 15px 0;
    line-height: 1.7;
    color: #444;
    font-size: 15px;
}

.domstol-result-keywords {
    margin: 15px 0;
}

.domstol-keyword-tag {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    margin-right: 8px;
    margin-bottom: 8px;
}

.domstol-result-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Buttons */
.domstol-btn-view,
.domstol-btn-pdf,
.domstol-btn-detail {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px !important;
    background: #000000;
    color: #ffffff !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.3s, transform 0.1s, opacity 0.3s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.domstol-btn-view:hover,
.domstol-btn-pdf:hover:not(:disabled),
.domstol-btn-detail:hover {
    background: #333333;
    color: #ffffff !important;
    transform: translateY(-1px);
}

.domstol-btn-view:active,
.domstol-btn-pdf:active,
.domstol-btn-detail:active {
    transform: translateY(0);
}

.domstol-btn-pdf {
    background: #000000;
}

.domstol-btn-pdf:hover:not(:disabled) {
    background: #333333;
}

.domstol-btn-pdf:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none !important;
}

/* Loading State */
.domstol-loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: #666;
}

.domstol-loading::before {
    content: '';
    display: block;
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.domstol-error {
    background: #ffebee;
    color: #c62828;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #c62828;
}

/* Pagination */
.domstol-pagination {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.domstol-pagination button {
    margin: 0 5px;
    padding: 10px 18px;
    background: #000;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s, transform 0.1s;
}

.domstol-pagination button:hover:not(:disabled) {
    background: #004080;
    transform: translateY(-1px);
}

.domstol-pagination button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.domstol-pagination button.active {
    background: #1976d2;
}

/* Detail View Modal/Page */
.domstol-detail-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.domstol-detail-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #000;
}

.domstol-detail-header h2 {
    margin: 0 0 15px 0;
    color: #000;
    font-size: 28px;
    line-height: 1.3;
}

.domstol-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.domstol-detail-meta-item {
    display: flex;
    flex-direction: column;
}

.domstol-detail-meta-item strong {
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.domstol-detail-meta-item span {
    color: #333;
    font-size: 15px;
}

.domstol-detail-section {
    margin: 30px 0;
}

.domstol-detail-section h3 {
    color: #000;
    font-size: 20px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.domstol-detail-content {
    line-height: 1.8;
    color: #333;
    font-size: 16px;
}

.domstol-detail-list {
    list-style: none;
    padding: 0;
}

.domstol-detail-list li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.domstol-detail-list li:last-child {
    border-bottom: none;
}

/* Back Button */
.domstol-back-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: #666;
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    transition: background 0.3s;
}

.domstol-back-btn:hover {
    background: #555;
    color: white !important;
}

.domstol-back-btn::before {
    content: '← ';
    margin-right: 5px;
}

/* Badge for Precedent */
.domstol-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.domstol-badge-precedent {
    background: #ffd700;
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .domstol-search-container {
        padding: 15px;
    }
    
    .domstol-search-form {
        padding: 20px;
    }
    
    .domstol-filter-row {
        grid-template-columns: 1fr;
    }
    
    .domstol-result-item {
        padding: 20px;
    }
    
    .domstol-result-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .domstol-result-actions {
        flex-direction: column;
    }
    
    .domstol-btn-view,
    .domstol-btn-pdf,
    .domstol-btn-detail {
        width: 100%;
        justify-content: center;
    }
    
    .domstol-detail-container {
        padding: 20px;
    }
    
    .domstol-detail-meta {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .domstol-search-form,
    .domstol-result-actions,
    .domstol-pagination,
    .domstol-back-btn {
        display: none;
    }
    
    .domstol-result-item {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}