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

body {
    background: #1a1a1b;
    color: #d7dadc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

a {
    color: #4fbcff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Navbar */
.navbar {
    background: #272729;
    padding: 12px 24px;
    border-bottom: 1px solid #343536;
}

.nav-brand {
    color: #ff4500;
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-brand:hover {
    text-decoration: none;
    color: #ff5722;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Search Page */
.search-page {
    text-align: center;
    padding-top: 120px;
}

.search-page h1 {
    font-size: 2.5rem;
    color: #ff4500;
    margin-bottom: 12px;
}

.subtitle {
    color: #818384;
    margin-bottom: 32px;
    font-size: 1.1rem;
}

.search-form {
    margin-bottom: 24px;
}

.search-box {
    display: inline-flex;
    align-items: center;
    background: #272729;
    border: 1px solid #343536;
    border-radius: 8px;
    overflow: hidden;
    font-size: 1.1rem;
}

.search-box .prefix {
    padding: 12px 4px 12px 16px;
    color: #818384;
    font-weight: 600;
}

.search-box input {
    background: transparent;
    border: none;
    color: #d7dadc;
    padding: 12px 8px;
    font-size: 1.1rem;
    width: 300px;
    outline: none;
}

.search-box input::placeholder {
    color: #555;
}

.search-box button {
    background: #ff4500;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
}

.search-box button:hover {
    background: #ff5722;
}

.info {
    color: #555;
    font-size: 0.85rem;
}

.info a {
    color: #666;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #343536;
    border-top-color: #ff4500;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-top: 24px;
}

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

/* Results Page */
.user-header {
    margin-bottom: 24px;
}

.user-header h1 {
    color: #ff4500;
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.stats span {
    background: #272729;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.deleted-stat {
    color: #ff6b6b;
    background: #3a2020 !important;
}

.source-stats {
    color: #555;
    font-size: 0.8rem;
    margin-top: 8px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid #343536;
}

.tab {
    background: transparent;
    border: none;
    color: #818384;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab:hover {
    color: #d7dadc;
}

.tab.active {
    color: #ff4500;
    border-bottom-color: #ff4500;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Cards */
.card {
    background: #272729;
    border: 1px solid #343536;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.card.deleted {
    border-left: 3px solid #ff6b6b;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.subreddit {
    color: #ff4500;
    font-weight: 600;
}

.timestamp {
    color: #818384;
}

.score {
    color: #818384;
    margin-left: auto;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.deleted-badge {
    background: #ff6b6b22;
    color: #ff6b6b;
}

/* Post content */
.post-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

.post-title a {
    color: #d7dadc;
}

.post-title a:hover {
    color: #4fbcff;
}

.post-body {
    color: #a0a0a0;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 8px;
}

.post-body.removed, .removed {
    color: #ff6b6b;
    font-style: italic;
}

.post-url {
    font-size: 0.8rem;
    margin-bottom: 8px;
    word-break: break-all;
}

/* Comment content */
.comment-context {
    font-size: 0.85rem;
    color: #818384;
    margin-bottom: 8px;
}

.comment-body {
    color: #a0a0a0;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Media thumbnails in posts */
.media-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.media-thumb {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 6px;
    overflow: hidden;
    background: #1a1a1b;
    display: block;
}

.media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb.broken {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #555;
}

.media-thumb.broken img {
    display: none;
}

.media-thumb.broken::after {
    content: "unavailable";
    color: #555;
    font-size: 0.7rem;
}

.video-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 1;
    pointer-events: none;
}

/* Media Gallery */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #272729;
    display: block;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item.broken {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #555;
}

.gallery-item.broken img {
    display: none;
}

.gallery-item.broken::after {
    content: "unavailable";
    color: #555;
    font-size: 0.75rem;
}

/* Empty state */
.empty {
    text-align: center;
    padding: 48px;
    color: #818384;
}

/* Responsive */
@media (max-width: 600px) {
    .search-page {
        padding-top: 60px;
    }

    .search-box input {
        width: 180px;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
