/* TOMA Legal Libraries - Phase 3 Styles */

.toma-libraries-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Search Section */
.toma-search-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.toma-search-section h2 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 28px;
    text-align: center;
}

.search-input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.search-input-group input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.search-input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 600;
}

.search-btn:hover {
    background: #2980b9;
}

.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.filter-group select,
.filter-group input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #3498db;
}

/* Libraries Grid */
.toma-libraries-grid {
    display: grid;
    gap: 40px;
}

.library-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
}

.library-title {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 20px 30px;
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.library-stats {
    background: #ecf0f1;
    padding: 15px 30px;
    display: flex;
    gap: 30px;
    border-bottom: 1px solid #ddd;
}

.stat-item {
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
}

.library-content {
    padding: 30px;
}

/* Library Items */
.library-item {
    background: #fff;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.library-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.item-title {
    color: #2c3e50;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
    line-height: 1.4;
}

.item-status,
.item-type {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.item-type {
    background: #ecf0f1;
    color: #7f8c8d;
}

.status-active {
    background: #d5f4e6;
    color: #27ae60;
}

.status-repealed {
    background: #fadbd8;
    color: #e74c3c;
}

.status-amended {
    background: #fef9e7;
    color: #f39c12;
}

.status-omitted {
    background: #e9ecef;
    color: #495057;
}

.status-spent {
    background: #dee2e6;
    color: #343a40;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

.meta-item {
    background: #f8f9fa;
    color: #6c757d;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid #e9ecef;
}

.item-summary {
    color: #5d6d7e;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 14px;
}

.item-index {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border-left: 4px solid #3498db;
}

.item-index strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 8px;
}

.index-content {
    color: #5d6d7e;
    font-size: 14px;
    line-height: 1.5;
}

.item-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.item-actions button,
.item-actions a {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
}

.btn-view {
    background: #3498db;
    color: white;
}

.btn-view:hover {
    background: #2980b9;
}

.btn-read {
    background: #27ae60;
    color: white;
}

.btn-read:hover {
    background: #229954;
}

.btn-download {
    background: #e67e22;
    color: white;
}

.btn-download:hover {
    background: #d35400;
}

/* Search Results */
.search-results {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 30px;
    margin-top: 30px;
}

.search-results h3 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.results-section {
    margin-bottom: 30px;
}

.results-section h4 {
    color: #3498db;
    margin-bottom: 15px;
    font-size: 18px;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .toma-libraries-container {
        padding: 15px;
    }
    
    .search-input-group {
        flex-direction: column;
    }
    
    .search-filters {
        grid-template-columns: 1fr;
    }
    
    .library-title {
        font-size: 20px;
        padding: 15px 20px;
    }
    
    .library-content {
        padding: 20px;
    }
    
    .library-item {
        padding: 20px;
    }
    
    .item-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .item-actions {
        justify-content: center;
    }
    
    .library-stats {
        flex-direction: column;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    .toma-search-section,
    .item-actions {
        display: none !important;
    }
    
    .library-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* Accessibility */
.library-item:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Animation for new content */
.library-item {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Special styling for law items with repealed status */
.law-item.status-repealed {
    opacity: 0.8;
    position: relative;
}

.law-item.status-repealed::before {
    content: "REPEALED";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 4px;
    transform: rotate(15deg);
}

/* Enhanced case items */
.case-item .item-title {
    color: #8e44ad;
}

.case-item .library-title {
    background: linear-gradient(135deg, #8e44ad 0%, #7d3c98 100%);
}

/* Enhanced precedent items */
.precedent-item .item-title {
    color: #d35400;
}

.precedent-item .library-title {
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
}
