/* === Block-Based Design === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-lighter: #252542;
    --primary: #e94560;
    --primary-hover: #d63451;
    --accent: #16213e;
    --text-white: #ffffff;
    --text-gray: #a0a0a0;
    --border: #303050;
    --success: #00d9a0;
    --warning: #ffb800;
    --error: #ff4757;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.page-wrapper {
    display: flex;
    flex: 1;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 320px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

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

/* === Hero === */
.hero {
    background: var(--bg-card);
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
}

.hero-content {
    text-align: center;
}

.hero-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
}

.hero-title span {
    color: var(--primary);
}

.hero-subtitle {
    font-size: 14px;
    color: var(--text-gray);
}

/* === Main Block === */
.main-block {
    padding: 25px 0;
}

/* === Upload Section === */
.upload-section {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.upload-area {
    flex: 1;
}

.sidebar-right {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* === Upload Block === */
.upload-block {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.upload-block.drag-over {
    border-color: var(--primary);
    background: var(--bg-lighter);
}

.upload-icon {
    width: 55px;
    height: 55px;
    margin: 0 auto 12px;
    color: var(--text-gray);
    transition: color 0.3s ease;
}

.upload-block:hover .upload-icon {
    color: var(--primary);
}

.upload-text {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-white);
}

.upload-subtext {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 10px;
}

.upload-info {
    font-size: 11px;
    color: var(--text-gray);
    opacity: 0.7;
}

/* === Files Grid === */
.files-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.file-card {
    background: var(--bg-lighter);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.file-card:hover {
    border-color: var(--primary);
}

.file-card.processing {
    border-color: var(--warning);
}

.file-card.done {
    border-color: var(--success);
}

.file-card.error {
    border-color: var(--error);
}

.file-preview {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-dark);
    border-radius: 6px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-preview-icon {
    font-size: 18px;
    color: var(--text-gray);
}

.file-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.file-size {
    font-size: 9px;
    color: var(--text-gray);
}

.file-status-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    background: var(--warning);
    color: var(--bg-dark);
}

.file-status-badge.processing {
    background: var(--primary);
    color: white;
    animation: spin 1s linear infinite;
}

.file-status-badge.done {
    background: var(--success);
    color: var(--bg-dark);
}

.file-status-badge.error {
    background: var(--error);
    color: white;
}

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

.file-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: var(--error);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.file-card:hover .file-remove {
    opacity: 1;
}

/* === Format Block === */
.format-block {
    background: var(--bg-lighter);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid var(--border);
}

.format-section-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-option {
    padding: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.format-option:hover {
    border-color: var(--primary);
}

.format-option.active {
    background: var(--primary);
    border-color: var(--primary);
}

.format-option-icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.format-option.active .format-option-icon {
    background: rgba(255, 255, 255, 0.2);
}

.format-option-info {
    flex: 1;
}

.format-option-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-white);
}

.format-option-desc {
    font-size: 10px;
    color: var(--text-gray);
}

/* === Action Buttons === */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-convert {
    padding: 14px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-convert:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.3);
}

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

.btn-clear {
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-clear:hover {
    border-color: var(--error);
    color: var(--error);
}

/* === Progress Block === */
.progress-block {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid var(--border);
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 12px;
    color: var(--text-white);
}

.progress-count {
    font-size: 11px;
    color: var(--text-gray);
}

.progress-bar {
    height: 5px;
    background: var(--bg-lighter);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff6b8a);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* === Download Block === */
.download-block {
    background: linear-gradient(135deg, var(--success) 0%, #00c896 100%);
    border-radius: 12px;
    padding: 15px;
    border: none;
}

.download-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--bg-dark);
    font-weight: 700;
    font-size: 13px;
}

.download-header svg {
    width: 20px;
    height: 20px;
}

.download-files {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.download-files::-webkit-scrollbar {
    width: 4px;
}

.download-files::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.download-files::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

.download-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin-bottom: 6px;
}

.download-file-item:last-child {
    margin-bottom: 0;
}

.download-file-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--bg-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.btn-download-all {
    width: 100%;
    padding: 12px;
    background: var(--bg-dark);
    border: none;
    border-radius: 8px;
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-download-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* === Features === */
.features-block {
    padding: 30px 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.features-title {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.feature-card {
    background: var(--bg-lighter);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.feature-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon svg {
    width: 18px;
    height: 18px;
    color: var(--text-white);
}

.feature-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-white);
}

.feature-text {
    font-size: 11px;
    color: var(--text-gray);
    line-height: 1.4;
}

/* === Sidebar Widgets === */
.sidebar-widget {
    background: var(--bg-lighter);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.sidebar-widget-header {
    background: linear-gradient(135deg, var(--primary) 0%, #ff6b8a 100%);
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-widget-title {
    font-weight: 700;
    font-size: 12px;
    color: white;
}

.sidebar-widget-link {
    color: white;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.sidebar-widget-link:hover {
    opacity: 1;
}

.sidebar-widget-content {
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
}

.sidebar-widget-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-widget-content::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

.sidebar-widget-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.rss-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: block;
    text-decoration: none;
    transition: background 0.3s ease;
}

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

.rss-item:hover {
    background: var(--bg-lighter);
}

.rss-item-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rss-item-meta {
    font-size: 9px;
    color: var(--text-gray);
}

.rss-loading {
    padding: 12px;
    text-align: center;
    color: var(--text-gray);
    font-size: 11px;
}

.activity-widget-content {
    padding: 8px;
    max-height: 200px;
    overflow: hidden;
}

.activity-items {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: var(--bg-dark);
    border-radius: 5px;
    font-size: 10px;
}

/* Тиктинговая анимация - появляется снизу и уползает вверх */
@keyframes scrollUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    10% {
        opacity: 1;
        transform: translateY(0);
    }
    80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.activity-avatar {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: linear-gradient(135deg, var(--primary), #ff6b8a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 8px;
    color: white;
    flex-shrink: 0;
}

.activity-text {
    flex: 1;
    min-width: 0;
}

.activity-user {
    font-weight: 600;
    color: var(--text-white);
}

.activity-action {
    color: var(--text-gray);
}

.activity-file {
    color: var(--primary);
    font-weight: 500;
}

/* === Footer === */
.footer-block {
    background: var(--bg-dark);
    padding: 15px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer-text {
    color: var(--text-gray);
    font-size: 11px;
}

/* === Utilities === */
.hidden {
    display: none !important;
}

/* === Responsive === */
@media (max-width: 900px) {
    .page-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .upload-section {
        flex-direction: column;
    }

    .sidebar-right {
        width: 100%;
    }

    .files-grid {
        grid-template-columns: repeat(4, 1fr);
    }

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

@media (max-width: 600px) {
    .hero-title {
        font-size: 24px;
    }

    .files-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 15px;
    }
}
