* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --text-primary: #000000;
    --text-secondary: #666666;
    --accent: #007bff;
    --accent-hover: #0056b3;
    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --like-color: #28a745;
    --dislike-color: #dc3545;
}

.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent: #4a9eff;
    --accent-hover: #357abd;
    --border: #404040;
    --shadow: rgba(0, 0, 0, 0.5);
    --card-bg: #2d2d2d;
}

.high-contrast {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #ffffff;
    --border: #ffffff;
    --card-bg: #1a1a1a;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
    font-size: 16px;
    line-height: 1.6;
}

body[dir="rtl"] {
    font-family: 'Segoe UI', Arial, sans-serif;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 2.5em;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent), #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-icon {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.2em;
}

.btn-icon:hover {
    transform: scale(1.1);
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--shadow);
}

#langSelect,
#autoplaySpeed {
    padding: 10px 15px;
    border: 2px solid var(--border);
    border-radius: 25px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

#langSelect:hover,
#autoplaySpeed:hover {
    border-color: var(--accent);
}

#playPauseBtn.playing {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    animation: pulse 2s infinite;
}

#playPauseBtn.playing:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(74, 158, 255, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(74, 158, 255, 0);
    }
}

#autoplaySpeed {
    min-width: 120px;
}

.autoplay-indicator {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--accent);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    z-index: 100;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    align-items: center;
    gap: 8px;
}

body[dir="rtl"] .autoplay-indicator {
    right: auto;
    left: 20px;
}

.indicator-icon {
    animation: pulse-icon 1.5s infinite;
}

@keyframes pulse-icon {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.gallery-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding-bottom: 50px;
}

.post-card {
    background: var(--card-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 24px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    touch-action: pan-y;
    cursor: grab;
}

.post-card:active {
    cursor: grabbing;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px var(--shadow);
}

.post-card.pinned {
    border: 3px solid var(--accent);
}

.post-card.pinned::before {
    content: '📌';
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    font-size: 1.5em;
    background: var(--card-bg);
    padding: 5px;
    border-radius: 50%;
}

.post-media {
    width: 100%;
    position: relative;
    background: var(--bg-secondary);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.post-media img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.3s;
}

.post-media img:hover {
    transform: scale(1.02);
}

.post-media video {
    width: 100%;
    max-height: 600px;
    cursor: pointer;
}

.embed-container {
    width: 100%;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.embed-container iframe {
    width: 100%;
    min-height: 400px;
    border: none;
}

/* Embed Carousel */
.embed-carousel-card {
    margin-bottom: 30px;
}

.embed-carousel-container {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 20px;
    background: var(--bg-secondary);
    min-height: 400px;
}

.embed-carousel-wrapper {
    display: flex;
    transition: transform 0.5s ease-in-out;
    will-change: transform;
    width: 100%;
}

.embed-carousel-slide {
    min-width: 100%;
    width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.embed-carousel-slide.active {
    opacity: 1;
}

.embed-slide-info {
    padding: 20px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
}

.embed-slide-info h3 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.embed-slide-info p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 2em;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 15px;
}

.carousel-next {
    right: 15px;
}

.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 15px;
    border-radius: 25px;
    backdrop-filter: blur(5px);
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.carousel-dot.active {
    background: var(--accent);
    border-color: white;
    transform: scale(1.3);
}

.carousel-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    z-index: 10;
    backdrop-filter: blur(5px);
}

.embed-actions-wrapper {
    position: relative;
    width: 100%;
}

.embed-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.url-preview {
    padding: 40px;
    text-align: center;
}

.url-link {
    display: block;
    color: var(--accent);
    text-decoration: none;
    font-size: 1.2em;
    margin-bottom: 20px;
    word-break: break-all;
    transition: color 0.3s;
}

.url-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.btn-open {
    padding: 12px 30px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-open:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.post-content {
    padding: 25px;
}

.post-content h2 {
    font-size: 1.8em;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.post-content p {
    color: var(--text-secondary);
    line-height: 1.8;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 25px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1em;
}

.action-btn:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

.like-btn:hover {
    border-color: var(--like-color);
    background: rgba(40, 167, 69, 0.1);
}

.like-btn.liked {
    background: rgba(40, 167, 69, 0.2) !important;
    border-color: var(--like-color) !important;
    color: var(--like-color);
}

.like-btn.liked:hover {
    background: rgba(40, 167, 69, 0.3) !important;
}

.dislike-btn:hover {
    border-color: var(--dislike-color);
    background: rgba(220, 53, 69, 0.1);
}

.dislike-btn.disliked {
    background: rgba(220, 53, 69, 0.2) !important;
    border-color: var(--dislike-color) !important;
    color: var(--dislike-color);
}

.dislike-btn.disliked:hover {
    background: rgba(220, 53, 69, 0.3) !important;
}

.share-btn:hover {
    border-color: var(--accent);
    background: rgba(74, 158, 255, 0.1);
    transform: scale(1.05);
}

.share-btn:active {
    transform: scale(0.95);
}

.action-btn .icon {
    font-size: 1.2em;
}

.views-count {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    margin-left: auto;
}

.admin-action {
    padding: 8px 12px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
}

.modal-content img,
.modal-content video {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 10px;
}

.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: transform 0.3s;
}

.close-fullscreen:hover {
    transform: scale(1.2);
}

#urlFrame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.modal-dialog {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px var(--shadow);
}

.modal-dialog h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-dialog input,
.modal-dialog textarea,
.modal-dialog select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
}

.modal-dialog textarea {
    min-height: 100px;
    resize: vertical;
}

.modal-dialog button {
    padding: 12px 25px;
    margin: 5px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s;
}

.modal-dialog button:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-secondary);
    text-align: center;
}

.file-upload-label:hover {
    border-color: var(--accent);
    background: var(--card-bg);
    transform: scale(1.02);
}

.file-upload-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

#fileUploadText {
    color: var(--text-primary);
    font-size: 1em;
}

#filePreview {
    text-align: center;
}

#filePreview img,
#filePreview video {
    border: 2px solid var(--border);
    border-radius: 10px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    width: 0%;
    transition: width 0.3s;
    border-radius: 10px;
}

#progressText {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.accessibility-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 24px var(--shadow);
    z-index: 999;
    display: none;
    min-width: 250px;
    border: 2px solid var(--border);
}

.accessibility-panel.active {
    display: block;
}

.accessibility-panel h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.accessibility-panel label {
    display: block;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.accessibility-panel input[type="range"] {
    width: 100%;
    margin-top: 5px;
}

.accessibility-panel input[type="checkbox"] {
    margin-right: 8px;
}

.empty-state {
    text-align: center;
    padding: 100px 20px;
    color: var(--text-secondary);
    font-size: 1.5em;
}

/* Swipe animations */
.post-card.swipe-left {
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.post-card.swipe-right {
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .post-media {
        min-height: 300px;
    }
    
    .post-content h2 {
        font-size: 1.4em;
    }
    
    .post-actions {
        gap: 10px;
    }
    
    .action-btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    
    .modal-dialog {
        padding: 20px;
        width: 95%;
    }
    
    .accessibility-panel {
        right: 10px;
        left: 10px;
        top: 100px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 15px 0;
    }
    
    header h1 {
        font-size: 1.5em;
    }
    
    .post-card {
        border-radius: 15px;
    }
    
    .post-content {
        padding: 15px;
    }
    
    .post-actions {
        padding: 15px;
    }
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card {
    animation: fadeIn 0.5s ease-out;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .controls,
    .post-actions {
        display: none;
    }
}

