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

:root {
    --primary-color: #52a675;
    --secondary-color: #2c3e35;
    --bg-color: #e8f3ec;
    --card-bg: #f8fcf9;
    --border-color: #c8dfd0;
    --text-primary: #2c3e35;
    --text-secondary: #5a7564;
    --hover-bg: #d4e9dc;
    --shadow: 0 2px 12px rgba(82, 166, 117, 0.15);
    --shadow-hover: 0 6px 20px rgba(82, 166, 117, 0.25);
    --header-bg: rgba(248, 252, 249, 0.85);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #e8f3ec 0%, #f0f8f2 50%, #e8f3ec 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: 40px;
}

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

/* Header Styles */
.header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(82, 166, 117, 0.1);
    z-index: 1000;
    border-radius: 24px;
    margin: 0 auto 30px;
    max-width: 1400px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.favorites-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #52a675 0%, #5cb382 100%);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(82, 166, 117, 0.3);
}

.favorites-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(82, 166, 117, 0.4);
}

.fav-icon {
    font-size: 16px;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-icon {
    font-size: 32px;
}

.stats {
    display: flex;
    gap: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

.stat-item strong {
    color: var(--primary-color);
    font-size: 16px;
}

/* Filter Styles */
.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 30px 25px;
    border-top: 1px solid var(--border-color);
}

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

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn,
.sort-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-btn:hover,
.sort-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.filter-btn.active,
.sort-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.month-select,
.author-select,
.search-input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}

.month-select:focus,
.author-select:focus,
.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-input {
    width: 100%;
}

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 400px);
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Tweet Container */
.tweet-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Tweet Card */
.tweet-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: text;
    animation: fadeIn 0.4s ease;
    display: flex;
    flex-direction: column;
    height: fit-content;
    user-select: text;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tweet-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
    transform: translateY(-3px);
}

.tweet-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-handle {
    font-size: 13px;
    color: var(--text-secondary);
}

.tweet-date {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tweet-content {
    margin: 16px 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    word-wrap: break-word;
}

.tweet-content a {
    color: var(--primary-color);
    text-decoration: none;
}

.tweet-content a:hover {
    text-decoration: underline;
}

.tweet-media {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
}

.media-grid {
    display: grid;
    gap: 4px;
}

.media-grid.single {
    grid-template-columns: 1fr;
}

.media-grid.multiple {
    grid-template-columns: repeat(2, 1fr);
}

.tweet-image,
.tweet-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--border-color);
}

.tweet-image {
    max-height: 400px;
}

.tweet-video {
    max-height: 300px;
}

.video-wrapper {
    position: relative;
    background: #000;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(29, 161, 242, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    pointer-events: none;
}

.tweet-stats {
    display: flex;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-icon {
    font-size: 16px;
}

.stat-value {
    font-weight: 600;
}

.retweet-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f0f8ff;
    color: var(--primary-color);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 80px 20px;
    font-size: 18px;
    color: var(--text-secondary);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 40px 0;
}

.page-btn {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: #1a91da;
    transform: scale(1.05);
}

.page-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.page-info span {
    color: var(--primary-color);
    font-weight: 700;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .title {
        font-size: 24px;
    }
    
    .filters {
        grid-template-columns: 1fr;
    }
    
    .tweet-container {
        max-width: 100%;
    }
    
    .pagination {
        flex-direction: column;
        gap: 12px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Media Modal */
.media-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    z-index: 10000;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.modal-close:hover {
    background: white;
    transform: rotate(90deg);
}

#modalMediaContainer img,
#modalMediaContainer video {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#modalMediaContainer video {
    background: #000;
}

/* Favorite Button in Card */
.tweet-favorite-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(248, 252, 249, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tweet-favorite-btn:hover {
    transform: scale(1.15);
    background: white;
    box-shadow: 0 4px 16px rgba(82, 166, 117, 0.4);
}

.tweet-favorite-btn.favorited {
    background: linear-gradient(135deg, #52a675 0%, #5cb382 100%);
    border-color: #52a675;
    color: white;
}

.tweet-card {
    position: relative;
}

/* Media clickable */
.tweet-image,
.tweet-video {
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.tweet-image:hover,
.video-wrapper:hover .tweet-video {
    opacity: 0.9;
}

/* Calendar Button */
.calendar-btn {
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(135deg, #52a675 0%, #5cb382 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(82, 166, 117, 0.3);
}

.calendar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(82, 166, 117, 0.4);
}

/* Calendar Modal */
.calendar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-container {
    position: relative;
    z-index: 10000;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.calendar-nav {
    width: 36px;
    height: 36px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-nav:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.calendar-weekdays div {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.calendar-day:hover {
    background: var(--hover-bg);
}

.calendar-day.has-tweets {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.calendar-day.has-tweets:hover {
    background: #459564;
    transform: scale(1.1);
}

.calendar-day.other-month {
    color: var(--border-color);
}

.calendar-day.today {
    border: 2px solid var(--primary-color);
}

.calendar-day.selected {
    background: var(--secondary-color);
    color: white;
    font-weight: 700;
}

.calendar-close-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-close-btn:hover {
    background: #459564;
}
