/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Container */
.container {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

h1 {
    color: white;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

/* Header */
.container > h1 {
    background: linear-gradient(135deg, #2c5aa0 0%, #1e3a8a 100%);
    color: white;
    padding: 30px;
    margin: -30px -30px 30px -30px;
    border-radius: 20px 20px 0 0;
}

/* Sections */
.section {
    background: #f9f9f9;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c5aa0;
    margin-bottom: 15px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

/* Query Builder */
.query-builder {
    background: white;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.builder-row {
    display: grid;
    grid-template-columns: 3fr 2fr auto;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.builder-row > div {
    display: flex;
    gap: 5px;
}

.builder-row button {
    padding: 10px 12px;
    white-space: nowrap;
    min-width: 60px;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    font-family: monospace;
    min-height: 100px;
}

/* Grid Layouts */
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

/* Buttons */
button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-add:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.btn-search {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    margin-top: 20px;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.btn-search:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.btn-clear {
    background: #f44336;
    color: white;
    margin-left: 10px;
}

.btn-clear:hover {
    background: #da190b;
}

.btn-remove {
    background: #ff5252;
    color: white;
    padding: 5px 12px;
    font-size: 12px;
}

/* Query Display */
.query-display {
    background: #fff9c4;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
    font-family: monospace;
    font-size: 13px;
    word-wrap: break-word;
    border: 1px solid #fbc02d;
}

.query-item {
    background: white;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 5px;
    border: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.query-item-text {
    flex: 1;
    font-family: monospace;
    font-size: 13px;
}

/* Info Boxes */
.info {
    background: #e3f2fd;
    color: #1565c0;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 13px;
}

.download-instructions {
    background: #fff9c4;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
    border-left: 4px solid #fbc02d;
}

.download-instructions h4 {
    margin-top: 0;
    color: #f57f17;
}

.download-instructions ol {
    margin: 10px 0;
    padding-left: 20px;
}

.download-instructions li {
    margin: 8px 0;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.loading.show {
    display: block;
}

/* Results */
.results {
    margin-top: 30px;
    display: none;
}

.results.show {
    display: block;
}

.result-item {
    background: white;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.result-title {
    font-size: 18px;
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 10px;
}

.result-meta {
    color: #666;
    font-size: 14px;
    margin: 5px 0;
}

.filename {
    background: #fff9c4;
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    font-family: monospace;
    font-size: 13px;
}

/* Access Badges */
.access-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
}

.badge-open {
    background: #4caf50;
    color: white;
}

.badge-limited {
    background: #ff9800;
    color: white;
}

.badge-restricted {
    background: #f44336;
    color: white;
}

/* Download Links */
.download-links {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
}

.download-links a {
    display: inline-block;
    padding: 8px 15px;
    margin: 5px 5px 5px 0;
    background: #4caf50;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
}

.download-links a:hover {
    background: #45a049;
}

.pdf-direct {
    background: #2196f3 !important;
}

.pdf-direct:hover {
    background: #1976d2 !important;
}

/* Error Messages */
.error {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 5px;
}

/* Pagination */
.pagination {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 2px solid #667eea;
}

.pagination-info {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #2c5aa0;
    margin-bottom: 15px;
}

.pagination-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-buttons button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.pagination-buttons button:hover:not(:disabled) {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.pagination-buttons button:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
}

#pageNumbers {
    display: flex;
    gap: 5px;
}

.page-number {
    padding: 8px 12px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.page-number:hover {
    background: #e3f2fd;
    transform: scale(1.05);
}

.page-number.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.export-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.btn-export, .btn-export-all {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-export {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
}

.btn-export:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(76, 175, 80, 0.3);
}

.btn-export-all {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.btn-export-all:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 152, 0, 0.3);
}