/* ==========================================================================
   Base Reset
   ========================================================================== */
.twitter-aio-video-downloader-container * {
    box-sizing: border-box;
    margin: 0;
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.twitter-aio-video-downloader-container {
    max-width: 800px;
    margin: 24px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1419;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border: 1px solid #1d9bf0;
}

/* ==========================================================================
   Header
   ========================================================================== */
.twitter-aio-header {
    padding: 20px 24px;
    background: #000000;
    border-bottom: 1px solid #1d9bf0;
    text-align: center;
}

.twitter-aio-header h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
}

.twitter-aio-header h3 img.twitter-icon {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.twitter-supported-features {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
}

.twitter-supported-features span {
    color: #8b98a5;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid #2f3336;
}

/* ==========================================================================
   URL Input
   ========================================================================== */
.twitter-url-input-section {
    padding: 24px;
    background: #000000;
}

.twitter-url-input-group {
    display: flex;
    gap: 8px;
}

.twitter-url-input-group input[type="url"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #2f3336;
    border-radius: 8px;
    font-size: 14px;
    background: #1d1f23;
    color: #e7e9ea;
    outline: none;
    transition: border-color 0.2s;
}

.twitter-url-input-group input[type="url"]:focus {
    border-color: #1d9bf0;
}

.twitter-url-input-group input[type="url"]::placeholder {
    color: #71767b;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.twitter-aio-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.twitter-aio-btn:hover {
    transform: translateY(-1px);
}

.twitter-aio-btn-primary {
    background: #1d9bf0;
    color: white;
}

.twitter-aio-btn-primary:hover {
    background: #1a8cd8;
}

.twitter-aio-btn-success {
    background: #00ba7c;
    color: white;
}

.twitter-aio-btn-success:hover {
    background: #00a16d;
}

/* ==========================================================================
   Progress
   ========================================================================== */
#twitter-aio-progress {
    padding: 16px 24px;
    background: #000000;
    border-top: 1px solid #2f3336;
    display: none;
}

#twitter-progress-label {
    margin-bottom: 8px;
    color: #8b98a5;
    font-size: 14px;
    text-align: center;
}

.twitter-progress-bar-container {
    height: 4px;
    background: #2f3336;
    border-radius: 2px;
    overflow: hidden;
}

.twitter-progress-bar {
    height: 100%;
    background: #1d9bf0;
    width: 0%;
    transition: width 0.3s;
}

#twitter-progress-percentage {
    text-align: center;
    margin-top: 5px;
    font-size: 12px;
    color: #8b98a5;
}

/* ==========================================================================
   Video Info
   ========================================================================== */
#twitter-video-info {
    padding: 16px 24px;
    background: #000000;
    border-bottom: 1px solid #2f3336;
    display: none;
}

.twitter-video-title-section {
    text-align: center;
}

#twitter-video-title {
    font-size: 16px;
    font-weight: 500;
    color: #e7e9ea;
    line-height: 1.4;
    word-break: break-word;
    margin: 0;
}

/* ==========================================================================
   Selected Downloads
   ========================================================================== */
#twitter-selected-download-container {
    padding: 16px 24px;
    background: rgba(0, 186, 124, 0.1);
    border-bottom: 1px solid #00ba7c;
    text-align: center;
    display: none;
}

#twitter-download-selected-btn {
    font-size: 14px;
    padding: 10px 20px;
}

#twitter-selected-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 6px;
}

/* ==========================================================================
   Format Tabs
   ========================================================================== */
.twitter-format-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    background: #000000;
    border-bottom: 1px solid #2f3336;
    overflow-x: auto;
}

.twitter-format-tab {
    padding: 8px 16px;
    border: 1px solid #2f3336;
    border-radius: 8px;
    background: #16181c;
    color: #8b98a5;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.twitter-format-tab:hover {
    border-color: #1d9bf0;
    color: #e7e9ea;
}

.twitter-format-tab.active {
    background: #1d9bf0;
    border-color: #1d9bf0;
    color: white;
}

/* ==========================================================================
   Format Options
   ========================================================================== */
.twitter-format-options {
    padding: 0;
    background: #000000;
    display: none;
}

.twitter-format-options.active {
    display: block;
}

.twitter-format-section {
    padding: 20px 24px;
    border-bottom: 1px solid #2f3336;
}

.twitter-format-section:last-child {
    border-bottom: none;
}

.twitter-format-section h5 {
    font-size: 14px;
    font-weight: 600;
    color: #e7e9ea;
    margin-bottom: 12px;
}

/* ==========================================================================
   Format Grid
   ========================================================================== */
.twitter-format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.twitter-format-card {
    padding: 12px;
    border: 1px solid #2f3336;
    border-radius: 8px;
    background: #16181c;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.twitter-format-card:hover {
    border-color: #1d9bf0;
    background: #1d1f23;
}

.twitter-format-card.selected {
    border-color: #00ba7c;
    background: rgba(0, 186, 124, 0.1);
}

.twitter-format-card.selected::before {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: #00ba7c;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.twitter-format-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.twitter-format-label {
    font-size: 13px;
    font-weight: 500;
    color: #e7e9ea;
}

.twitter-format-meta {
    font-size: 11px;
    color: #8b98a5;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.twitter-format-quality {
    font-size: 10px;
    padding: 2px 6px;
    background: #2f3336;
    border-radius: 4px;
    color: #8b98a5;
}

/* Format type borders */
.twitter-format-card.video { border-left: 3px solid #1d9bf0; }
.twitter-format-card.thumbnail { border-left: 3px solid #f91880; }

/* ==========================================================================
   Messages
   ========================================================================== */
.twitter-download-success,
.twitter-download-error {
    padding: 16px;
    border-radius: 8px;
    margin: 16px 24px;
    text-align: center;
    font-size: 14px;
}

.twitter-download-success {
    background: rgba(0, 186, 124, 0.1);
    border: 1px solid #00ba7c;
    color: #00ba7c;
}

.twitter-download-error {
    background: rgba(244, 33, 46, 0.1);
    border: 1px solid #f4212e;
    color: #f4212e;
}

.twitter-no-formats-message {
    padding: 24px;
    text-align: center;
    color: #8b98a5;
    font-style: italic;
    font-size: 14px;
}

/* ==========================================================================
   Results Area
   ========================================================================== */
#twitter-aio-result {
    min-height: 40px;
    padding: 0 24px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet */
@media (max-width: 768px) {
    .twitter-aio-video-downloader-container {
        margin: 16px;
        border-radius: 8px;
    }
    
    .twitter-aio-header,
    .twitter-url-input-section,
    .twitter-format-section {
        padding: 16px;
    }
    
    .twitter-url-input-group {
        flex-direction: column;
    }
    
    .twitter-aio-btn {
        width: 100%;
    }
    
    .twitter-format-tabs {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .twitter-format-tab {
        flex: 1;
        min-width: calc(50% - 4px);
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .twitter-format-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .twitter-aio-video-downloader-container {
        margin: 8px;
    }
    
    .twitter-aio-header h3 {
        font-size: 18px;
        gap: 8px;
    }
    
    .twitter-supported-features span {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .twitter-format-tab {
        min-width: calc(50% - 4px);
        padding: 6px 10px;
        font-size: 11px;
    }
}

/* Small Mobile */
@media (max-width: 360px) {
    .twitter-aio-header h3 {
        font-size: 16px;
    }
    
    .twitter-supported-features {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    .twitter-format-tab {
        font-size: 10px;
        padding: 5px 8px;
    }
    
    .twitter-aio-btn {
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .twitter-aio-video-downloader-container {
        max-width: 900px;
    }
    
    .twitter-format-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    
    .twitter-aio-btn:hover,
    .twitter-format-card:hover,
    .twitter-format-tab:hover {
        transform: none;
    }
}

/* Dark mode optimization (Twitter уже темный) */
@media (prefers-color-scheme: light) {
    .twitter-aio-video-downloader-container {
        background: #ffffff;
        border-color: #1d9bf0;
        color: #0f1419;
    }
    
    .twitter-aio-header,
    .twitter-url-input-section,
    #twitter-aio-progress,
    #twitter-video-info,
    .twitter-format-tabs,
    .twitter-format-options {
        background: #ffffff;
        border-color: #e1e8ed;
    }
    
    .twitter-aio-header h3,
    #twitter-video-title,
    .twitter-format-section h5,
    .twitter-format-label {
        color: #0f1419;
    }
    
    .twitter-url-input-group input[type="url"] {
        background: #f7f9fa;
        border-color: #cfd9de;
        color: #0f1419;
    }
    
    .twitter-format-tab {
        background: #f7f9fa;
        border-color: #cfd9de;
        color: #536471;
    }
    
    .twitter-format-card {
        background: #f7f9fa;
        border-color: #cfd9de;
    }
    
    .twitter-format-label {
        color: #0f1419;
    }
    
    .twitter-format-meta {
        color: #536471;
    }
    
    .twitter-supported-features span {
        color: #536471;
        border-color: #cfd9de;
        background: rgba(0, 0, 0, 0.05);
    }
}

/* Preview Formats */
.twitter-format-card.preview { 
    border-left: 3px solid #f91880; 
}

/* Для светлой темы */
@media (prefers-color-scheme: light) {
    .twitter-format-card.preview { 
        border-left: 3px solid #f91880; 
    }
}

/* Заменить старые селекторы thumbnail на preview */
#twitter-preview-format-options { /* вместо #twitter-thumbnail-format-options */ }

#twitter-preview-format-grid { /* вместо #twitter-thumbnail-format-grid */ }

.twitter-format-tab[data-type="preview"] { /* вместо [data-type="thumbnail"] */ }

/* Обновить цветовую схему для превью */
.twitter-format-card.preview { /* вместо .twitter-format-card.thumbnail */
    border-left: 3px solid #f91880; /* розовый Twitter */
}