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

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --text-primary: #262626;
    --text-secondary: #8e8e8e;
    --border-color: #dbdbdb;
    --accent-color: #0095f6;
    --accent-hover: #1877f2;
    --error-color: #ed4956;
    --success-color: #00c853;
    --gradient-start: #f09433;
    --gradient-mid: #d62976;
    --gradient-end: #962fbf;
}

body.dark {
    --bg-primary: #000000;
    --bg-secondary: #121212;
    --text-primary: #f5f5f5;
    --text-secondary: #a8a8a8;
    --border-color: #262626;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header h1 {
    font-size: 24px;
    background: linear-gradient(45deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

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

.header-actions button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions button:hover {
    background: var(--bg-primary);
    transform: scale(1.05);
}

/* Auth Container */
.auth-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 40px 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.auth-container h2 {
    margin-bottom: 24px;
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-container input {
    width: 100%;
    padding: 14px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.auth-container input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.auth-container button {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    font-size: 15px;
    transition: background 0.2s, transform 0.1s;
}

.auth-container button:hover {
    background: var(--accent-hover);
}

.auth-container button:active {
    transform: scale(0.98);
}

.auth-container p {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-container a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-container a:hover {
    text-decoration: underline;
}

.demo-credentials {
    display: none;
}

/* Error Message */
.error-message {
    background: rgba(237, 73, 86, 0.1);
    color: var(--error-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid rgba(237, 73, 86, 0.2);
}

.success-message {
    background: rgba(0, 200, 83, 0.1);
    color: var(--success-color);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid rgba(0, 200, 83, 0.2);
}

/* Posts */
.post {
    max-width: 600px;
    margin: 24px auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}

.post:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
}

.post-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

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

.post-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.post-time {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.post-menu {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.post-menu:hover {
    opacity: 1;
}

/* Admin delete button styling */
.admin-delete-btn {
    color: #ed4956;
    background: rgba(237, 73, 86, 0.1);
    border-radius: 4px;
}

.admin-delete-btn:hover {
    background: rgba(237, 73, 86, 0.2);
}

.post-menu:hover {
    background: var(--bg-primary);
}

.post-media {
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

.post-media img,
.post-media video {
    max-width: 100%;
    max-height: 600px;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Feed filters and tags */
.feed-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

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

.filter-btn:hover {
    background: var(--border-color);
}

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

.filter-tag-container {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-tag-btn {
    padding: 4px 12px;
    border-radius: 14px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag-btn:hover,
.filter-tag-btn.active {
    background: var(--accent-color);
    color: white;
}

/* Tag cloud */
.tag-cloud {
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
}

.tag-cloud-item {
    padding: 4px 12px;
    border-radius: 14px;
    background: var(--border-color);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-cloud-item:hover {
    background: var(--accent-color);
    color: white;
}

.tag-cloud-item .tag-subscribe {
    font-size: 10px;
    opacity: 0.6;
}

.tag-cloud-item .tag-subscribe.subscribed {
    opacity: 1;
    color: #4ade80;
}

/* Tag input in upload form */
.tag-input-area {
    padding: 8px 20px;
    border-top: 1px solid var(--border-color);
}

.tag-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.tag-input:focus {
    border-color: var(--accent-color);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--accent-color);
    color: white;
    font-size: 12px;
}

.selected-tag .remove-tag {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.7;
}

.selected-tag .remove-tag:hover {
    opacity: 1;
}

.tag-suggestions {
    position: absolute;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 150px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tag-suggestion {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
}

.tag-suggestion:hover {
    background: var(--border-color);
}

/* Tags on posts */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 8px;
}

.post-tag {
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--border-color);
    color: var(--text-secondary);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.post-tag:hover {
    background: var(--accent-color);
    color: white;
}

/* Subscribe button */
.subscribe-btn {
    padding: 4px 12px;
    border-radius: 14px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.subscribe-btn:hover {
    background: var(--accent-color);
    color: white;
}

.subscribe-btn.subscribed {
    background: var(--accent-color);
    color: white;
}

/* Post header with subscribe */
.post-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.post-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-username {
    font-weight: 600;
    font-size: 14px;
}

/* Post media single */
.post-media-single {
    position: relative;
}

.post-media-single img,
.post-media-single video {
    display: block;
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    background: #000;
}

.fullscreen-btn-inline {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
}

.post-media-single:hover .fullscreen-btn-inline {
    opacity: 0.8;
}

.fullscreen-btn-inline:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
}

/* Carousel */
.post-media-carousel {
    position: relative;
    background: #000;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.carousel-slide.active {
    visibility: visible;
    opacity: 1;
    z-index: 1;
}

.carousel-slide img,
.carousel-slide video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    pointer-events: auto;
    cursor: pointer;
}

/* Fullscreen enter button - bottom right of each slide */
.fullscreen-enter-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
}

.post-media-carousel:hover .fullscreen-enter-btn,
.carousel-slide.active .fullscreen-enter-btn {
    opacity: 0.8;
}

.fullscreen-enter-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
}

/* Delete media button - top-left of each slide */
.delete-media-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(237, 73, 86, 0.85);
    color: white;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, transform 0.2s;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.post-media-carousel:hover .delete-media-btn,
.carousel-slide.active .delete-media-btn,
.delete-media-btn.single-media {
    opacity: 0.8;
}

.delete-media-btn:hover {
    opacity: 1;
    background: rgba(237, 73, 86, 1);
    transform: scale(1.1);
}

/* Single media delete button always visible */
.delete-media-btn.single-media {
    opacity: 0.7;
}

/* Carousel counter - move to top-right to avoid overlap */

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    font-size: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 10;
}

.post-media-carousel:hover .carousel-btn {
    opacity: 0.7;
}

.carousel-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.7);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.carousel-dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.dot.active {
    background: white;
    transform: scale(1.2);
}

.carousel-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
}

.post-actions {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
}

.action-btn {
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    transform: scale(1.1);
    background: var(--bg-primary);
}

.like-btn.liked {
    color: var(--error-color);
    animation: likePop 0.3s ease;
}

@keyframes likePop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.post-likes {
    font-weight: 600;
    padding: 0 16px;
    margin-bottom: 8px;
    font-size: 14px;
}

.post-caption {
    padding: 0 16px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.post-caption strong {
    font-weight: 600;
    margin-right: 6px;
}

.post-comments {
    padding: 0 16px;
    margin-bottom: 10px;
}

.comment {
    font-size: 14px;
    margin-bottom: 6px;
    line-height: 1.4;
    word-break: break-word;
}

.comment strong {
    font-weight: 600;
    margin-right: 6px;
}

.comment-time {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: 8px;
}

.comment-form {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    gap: 8px;
}

.comment-input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 0;
    outline: none;
    font-size: 14px;
    color: var(--text-primary);
    max-height: 100px;
    overflow-y: auto;
}

.comment-submit {
    background: none;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    font-size: 14px;
}

.comment-submit.active {
    opacity: 1;
}

.comment-submit:hover {
    opacity: 0.8;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--bg-primary);
}

/* Upload */
.upload-area {
    padding: 20px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-dropzone {
    width: 100%;
    min-height: 150px;
    transition: all 0.2s;
}

.upload-dropzone.drag-over .upload-label {
    border-color: var(--accent-color);
    background: rgba(0, 149, 246, 0.05);
    transform: scale(1.02);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 40px;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
    text-align: center;
}

.upload-label:hover {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}

.upload-icon {
    font-size: 48px;
}

.upload-label span:nth-child(2) {
    font-weight: 600;
    font-size: 16px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Warning message */
.warning-message {
    background: rgba(255, 152, 0, 0.1);
    color: #ff9800;
    padding: 12px;
    border-radius: 8px;
    margin: 0 20px 16px;
    font-size: 13px;
    border: 1px solid rgba(255, 152, 0, 0.2);
}

/* Preview grid for multiple files */
.preview-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
    padding: 6px 0;
    max-height: 280px;
    overflow-y: auto;
}

.preview-grid-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: border-color 0.2s;
}

.preview-grid-item:hover {
    border-color: var(--accent-color);
}

.preview-grid-item img,
.preview-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-grid-item .preview-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.preview-grid-item:hover .preview-remove {
    opacity: 1;
}

.preview-grid-item .file-index {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
}

/* Upload footer */
.upload-footer {
    width: 100%;
    border-top: 1px solid var(--border-color);
}

.file-counter {
    padding: 8px 20px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

/* Upload progress */
.upload-progress {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-color);
    transition: width 0.3s ease;
    border-radius: 3px;
}

#progressText {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 100px;
    text-align: right;
}

#captionInput {
    width: 100%;
    padding: 16px 20px;
    border: none;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    resize: none;
    font-family: inherit;
    min-height: 100px;
}

#captionInput:focus {
    outline: none;
}

.char-count {
    padding: 8px 20px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

.upload-submit {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s;
}

.upload-submit:hover:not(:disabled) {
    background: var(--accent-hover);
}

.upload-submit:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Profile */
.profile-content {
    max-width: 400px;
}

.profile-info {
    padding: 30px 20px;
    text-align: center;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin: 0 auto 16px;
}

.profile-info h3 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-fullname {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 4px;
}

.profile-email {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat span:first-child {
    font-weight: 700;
    font-size: 20px;
}

.stat span:last-child {
    font-size: 12px;
    color: var(--text-secondary);
}

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

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
    .post {
        margin: 0 0 16px 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .auth-container {
        margin: 20px 16px;
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 20px;
    }

    .modal-content {
        max-height: 100vh;
        border-radius: 0;
        height: 100%;
    }

    .upload-label {
        padding: 30px 20px;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 5px;
    }

    .post-media-carousel {
        height: 350px;
    }

    .warning-message {
        margin: 0 16px 12px;
        font-size: 12px;
    }

    .upload-progress {
        flex-direction: column;
        gap: 8px;
    }

    #progressText {
        text-align: center;
        min-width: auto;
    }
}

/* Admin Panel Styles */
.admin-content {
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
}

.admin-section {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.admin-section h3 {
    margin-bottom: 12px;
    font-size: 16px;
    color: var(--text-primary);
}

.admin-hint {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
}

.folder-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.folder-item {
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.folder-item:hover {
    border-color: var(--accent-color);
    background: rgba(0, 149, 246, 0.05);
}

.folder-item.scanning {
    opacity: 0.5;
    pointer-events: none;
}

.folder-item.importing {
    opacity: 0.5;
    pointer-events: none;
}

.folder-name {
    font-weight: 600;
    font-size: 14px;
}

.folder-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

.folder-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.admin-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.admin-btn.primary {
    background: var(--accent-color);
    color: white;
}

.admin-btn.primary:hover {
    background: var(--accent-hover);
}

.admin-btn.secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.admin-btn.secondary:hover {
    background: var(--border-color);
}

.admin-btn.danger {
    background: var(--error-color);
    color: white;
}

.admin-btn.danger:hover {
    background: #d63845;
}

.admin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.admin-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.queue-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.queue-stat {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    text-align: center;
}

.queue-stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
}

.queue-stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.queue-folders {
    max-height: 200px;
    overflow-y: auto;
}

.queue-folder-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.queue-folder-item:last-child {
    border-bottom: none;
}

.queue-folder-name {
    font-size: 14px;
    font-weight: 500;
}

.queue-folder-stats {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.import-progress {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.import-progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.import-progress-fill {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s;
}

/* Preview Grid */
.preview-controls {
    margin-top: 12px;
}

.preview-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.preview-counter {
    margin-left: auto;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Admin preview grid (distinct from upload preview grid) */
.admin-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    max-height: 600px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 8px;
}

/* Admin preview items (distinct from upload preview) */
.preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.preview-item:hover {
    border-color: var(--accent-color);
    transform: scale(1.02);
}

.preview-item.selected {
    border-color: var(--accent-color);
    border-width: 3px;
}

.preview-item.selected::before {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    z-index: 10;
}

.preview-item-overlay {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.preview-item-overlay img,
.preview-item-overlay video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.selected-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.folder-badge {
    display: inline-block;
    background: rgba(0, 149, 246, 0.1);
    color: var(--accent-color);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-item-meta {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.preview-item-date {
    color: var(--text-secondary);
    font-size: 10px;
}

.preview-item-info {
    padding: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-item-size {
    margin-left: 8px;
    white-space: nowrap;
}

.import-section {
    margin-top: 16px;
    text-align: center;
}

.import-btn {
    padding: 12px 32px;
    font-size: 16px;
}

.folder-item {
    cursor: pointer;
}

.folder-preview-hint {
    font-size: 11px;
    color: var(--accent-color);
    margin-top: 4px;
}
