/* ============================================
   REDDIT ARCHIVE EXPLORER - GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #dae0e6;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styles */
.header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header h1 {
    color: #1a1a1b;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.back-link {
    display: inline-block;
    margin-bottom: 15px;
    color: #0079d3;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Search form styles */
.search-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.basic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1a1a1b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label i {
    color: #0079d3;
    width: 18px;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 1px solid #edeff1;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #0079d3;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #edeff1;
    flex-wrap: wrap;
}

.image-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f6f7f8;
    padding: 8px 16px;
    border-radius: 8px;
    margin-right: auto;
}

.image-toggle-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1a1a1b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #ff4500;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.form-actions button {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.apply-filters-btn {
    background: #0079d3;
    color: white;
}

.apply-filters-btn:hover {
    background: #005fa3;
}

.clear-link {
    padding: 10px 20px;
    background: #f6f7f8;
    color: #7c7c7c;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.clear-link:hover {
    background: #e9e9e9;
    color: #1a1a1b;
}

.advanced-mode-btn {
    background: #f6f7f8;
    color: #1a1a1b;
    border: 1px solid #edeff1;
}

.advanced-mode-btn:hover {
    background: #e9e9e9;
}

/* Advanced search sections */
.advanced-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #edeff1;
}

.search-section {
    margin-bottom: 25px;
}

.search-section h4 {
    font-size: 0.9rem;
    color: #1a1a1b;
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-section h4 i {
    color: #0079d3;
}

.advanced-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.advanced-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.advanced-field label {
    font-size: 0.8rem;
    color: #7c7c7c;
    font-weight: 500;
}

.advanced-field input {
    padding: 8px 12px;
    border: 1px solid #edeff1;
    border-radius: 6px;
    font-size: 0.85rem;
}

.advanced-field small {
    color: #7c7c7c;
    font-size: 0.7rem;
}

.date-range-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.date-range {
    display: flex;
    gap: 15px;
    flex: 1;
}

.reverse-order-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    white-space: nowrap;
}

.reverse-order-checkbox label {
    font-size: 0.85rem;
    color: #1a1a1b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reverse-order-checkbox label i {
    color: #1a1a1b;
}

.reverse-order-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Post styles */
.post {
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.post:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.post h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.post h2 a {
    color: #1a1a1b;
    text-decoration: none;
}

.post h2 a:hover {
    color: #0079d3;
    text-decoration: underline;
}

.post-meta {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #7c7c7c;
    align-items: center;
}

/* Specific meta links (used in different contexts) */
.author-link,
.subreddit-link {
    font-weight: 500;
    text-decoration: none;
    color: #7c7c7c;
    display: flex;
    align-items: center;
    gap: 4px;
}

.author-link:hover,
.subreddit-link:hover {
    color: #0079d3;
    text-decoration: underline;
}

.author-deleted {
    color: #ff4500;
}

.tag {
    background: #e9f0f5;
    color: #0079d3;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
}

.image-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #e9f0f5;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    color: #0079d3;
    margin-left: 8px;
}

/* Image preview */
.post-image-preview {
    margin-top: 12px;
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: filter 0.3s;
}

.post-image-preview img {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    display: block;
    border-radius: 8px;
}

.post-image-preview.blurred img {
    filter: blur(20px);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 8px;
}

.post-image-preview.blurred:hover .image-overlay {
    opacity: 1;
}

.image-overlay span {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.post-text-preview {
    margin-top: 12px;
    padding: 15px;
    background: #f6f7f8;
    border-radius: 8px;
    color: #5a5a5a;
    font-size: 0.9rem;
    line-height: 1.5;
    cursor: pointer;
    transition: background 0.2s;
}

.post-text-preview:hover {
    background: #e9e9e9;
}

.post-text-preview i {
    color: #7c7c7c;
    margin-right: 6px;
}

/* Pagination styles - SHARED BETWEEN BOTH FILES */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination a,
.pagination .pagination-numbers a,
.pagination .pagination-numbers span {
    padding: 8px 14px;
    background: white;
    border: 1px solid #edeff1;
    border-radius: 8px;
    text-decoration: none;
    color: #1a1a1b;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    line-height: 1;
    box-sizing: border-box;
}

/* First and Last page buttons (icon only) */
.pagination-first,
.pagination-last {
    padding: 8px 12px;
}

/* Ensure all pagination buttons have consistent height */
.pagination-arrow,
.pagination-numbers a,
.pagination-numbers span,
.pagination-goto button {
    height: 38px;
    box-sizing: border-box;
}

/* Icons inside buttons */
.pagination-arrow i {
    font-size: 0.9rem;
}

/* Space between icon and text in buttons */
.pagination-prev i {
    margin-right: 6px;
}

.pagination-next i {
    margin-left: 6px;
    margin-right: 0;
}

/* Icon-only buttons (double arrows) */
.pagination-first i,
.pagination-last i {
    font-size: 0.9rem;
}

.pagination a:hover {
    background: #f6f7f8;
    border-color: #ff4500;
    color: #ff4500;
}

.pagination .current {
    background: #ff4500;
    color: white;
    border-color: #ff4500;
}

.pagination-arrow {
    font-weight: 600;
    gap: 6px;
}

.pagination-ellipsis {
    background: transparent;
    border: none;
    cursor: default;
    color: #7c7c7c;
    padding: 8px 4px;
    height: auto;
    min-width: auto;
}

.pagination-numbers {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.pagination-goto {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
    padding-left: 15px;
    border-left: 1px solid #edeff1;
}

.pagination-goto label {
    font-size: 0.85rem;
    color: #7c7c7c;
}

.pagination-goto input {
    width: 65px;
    padding: 8px 10px;
    border: 1px solid #edeff1;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    height: 38px;
    box-sizing: border-box;
}

.pagination-goto input:focus {
    outline: none;
    border-color: #ff4500;
}

.pagination-goto button {
    padding: 0 18px;
    background: #ff4500;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
    height: 38px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination-goto button:hover {
    background: #e03e00;
}

/* Results info */
.results-info {
    margin-bottom: 20px;
    color: #7c7c7c;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.empty {
    background: white;
    padding: 60px;
    text-align: center;
    border-radius: 8px;
    color: #7c7c7c;
}

.empty i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
    .basic-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .advanced-row {
        grid-template-columns: 1fr;
    }
    
    .date-range {
        flex-direction: column;
    }
    
    .date-range-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .reverse-order-checkbox {
        justify-content: flex-start;
        margin-top: 10px;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .image-toggle {
        margin-right: 0;
        justify-content: center;
    }
    
    .form-actions button,
    .clear-link {
        width: 100%;
        text-align: center;
    }
    
    .results-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pagination {
        flex-direction: column;
        align-items: center;
    }
    
    .pagination-goto {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        margin-top: 10px;
    }
}
