/* ==========================================================================
   Base Reset
   ========================================================================== */
.tiktok-aio-downloader-container * {
    box-sizing: border-box;
    margin: 0;
}

/* ==========================================================================
   Main Container
   ========================================================================== */
.tiktok-aio-downloader-container {
    max-width: 800px;
    margin: 24px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid #fe2c55;
}

/* ==========================================================================
   Header
   ========================================================================== */
.tiktok-aio-header {
    padding: 20px 24px;
    background: #000000;
    border-bottom: 1px solid #fe2c55;
    text-align: center;
}

.tiktok-aio-header h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
}

.tiktok-aio-header h3 img.tiktok-icon {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.tiktok-supported-features {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    margin-bottom: 8px;
}

.tiktok-supported-features span {
    color: #b3b3b3;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border: 1px solid #333333;
}

/* Cookie Status (закомментирован в HTML) */
.tiktok-cookies-status {
    margin-top: 12px;
}

.tiktok-cookies-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid;
}

/* ==========================================================================
   URL Input
   ========================================================================== */
.tiktok-url-input-section {
    padding: 24px;
    background: #000000;
}

.tiktok-url-input-group {
    display: flex;
    gap: 8px;
}

.tiktok-url-input-group input[type="url"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #333333;
    border-radius: 8px;
    font-size: 14px;
    background: #121212;
    color: #ffffff;
    outline: none;
    transition: border-color 0.2s;
}

.tiktok-url-input-group input[type="url"]:focus {
    border-color: #fe2c55;
}

.tiktok-url-input-group input[type="url"]::placeholder {
    color: #666666;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.tiktok-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;
}

.tiktok-aio-btn:hover {
    transform: translateY(-1px);
}

.tiktok-aio-btn-primary {
    background: linear-gradient(45deg, #fe2c55, #25f4ee);
    color: white;
}

.tiktok-aio-btn-primary:hover {
    background: linear-gradient(45deg, #e91e50, #1ce6e0);
}

.tiktok-aio-btn-success {
    background: #25f4ee;
    color: #000000;
}

.tiktok-aio-btn-success:hover {
    background: #1ce6e0;
}

/* ==========================================================================
   Progress
   ========================================================================== */
#tiktok-aio-progress {
    padding: 16px 24px;
    background: #000000;
    border-top: 1px solid #333333;
    display: none;
}

#tiktok-progress-label {
    margin-bottom: 8px;
    color: #b3b3b3;
    font-size: 14px;
    text-align: center;
}

.tiktok-progress-bar-container {
    height: 4px;
    background: #333333;
    border-radius: 2px;
    overflow: hidden;
}

.tiktok-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #fe2c55, #25f4ee);
    width: 0%;
    transition: width 0.3s;
}

#tiktok-progress-percentage {
    text-align: center;
    margin-top: 5px;
    font-size: 12px;
    color: #b3b3b3;
}

/* ==========================================================================
   Video Info & Stats
   ========================================================================== */
#tiktok-video-info {
    padding: 16px 24px;
    background: #000000;
    border-bottom: 1px solid #333333;
    display: none;
}

.tiktok-video-title-section {
    text-align: center;
    margin-bottom: 16px;
}

#tiktok-video-title {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    line-height: 1.4;
    word-break: break-word;
    margin: 0;
}

.tiktok-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.tiktok-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid #333333;
}

.tiktok-stat-item i {
    color: #fe2c55;
    font-size: 14px;
}

.tiktok-stat-item span {
    font-size: 12px;
    color: #b3b3b3;
    font-weight: 500;
}

/* ==========================================================================
   Selected Downloads
   ========================================================================== */
#tiktok-selected-download-container {
    padding: 16px 24px;
    background: rgba(37, 244, 238, 0.1);
    border-bottom: 1px solid #25f4ee;
    text-align: center;
    display: none;
}

#tiktok-download-selected-btn {
    font-size: 14px;
    padding: 10px 20px;
}

#tiktok-selected-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 6px;
}

/* ==========================================================================
   Format Tabs
   ========================================================================== */
.tiktok-format-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    background: #000000;
    border-bottom: 1px solid #333333;
    overflow-x: auto;
}

.tiktok-format-tab {
    padding: 8px 16px;
    border: 1px solid #333333;
    border-radius: 8px;
    background: #121212;
    color: #b3b3b3;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tiktok-format-tab:hover {
    border-color: #fe2c55;
    color: #ffffff;
}

.tiktok-format-tab.active {
    background: linear-gradient(45deg, #fe2c55, #25f4ee);
    border-color: transparent;
    color: white;
}

/* ==========================================================================
   Format Options
   ========================================================================== */
.tiktok-format-options {
    padding: 0;
    background: #000000;
    display: none;
}

.tiktok-format-options.active {
    display: block;
}

.tiktok-format-section {
    padding: 20px 24px;
    border-bottom: 1px solid #333333;
}

.tiktok-format-section:last-child {
    border-bottom: none;
}

.tiktok-format-section h5 {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 12px;
}

/* ==========================================================================
   Format Grid
   ========================================================================== */
.tiktok-format-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.tiktok-format-card {
    padding: 12px;
    border: 1px solid #333333;
    border-radius: 8px;
    background: #121212;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tiktok-format-card:hover {
    border-color: #fe2c55;
    background: #1a1a1a;
}

.tiktok-format-card.selected {
    border-color: #25f4ee;
    background: rgba(37, 244, 238, 0.1);
}

.tiktok-format-card.selected::before {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 18px;
    height: 18px;
    background: #25f4ee;
    color: #000000;
    border-radius: 50%;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tiktok-format-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tiktok-format-label {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
}

.tiktok-format-meta {
    font-size: 11px;
    color: #b3b3b3;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tiktok-format-quality {
    font-size: 10px;
    padding: 2px 6px;
    background: #333333;
    border-radius: 4px;
    color: #b3b3b3;
}

/* Format type borders */
.tiktok-format-card.video.with-audio { border-left: 3px solid #25f4ee; }
.tiktok-format-card.video.no-watermark { border-left: 3px solid #00ff00; }
.tiktok-format-card.audio { border-left: 3px solid #fe2c55; }
.tiktok-format-card.thumbnail { border-left: 3px solid #ffd700; }

/* ==========================================================================
   Messages
   ========================================================================== */
.tiktok-download-success,
.tiktok-download-error {
    padding: 16px;
    border-radius: 8px;
    margin: 16px 24px;
    text-align: center;
    font-size: 14px;
}

.tiktok-download-success {
    background: rgba(37, 244, 238, 0.1);
    border: 1px solid #25f4ee;
    color: #25f4ee;
}

.tiktok-download-error {
    background: rgba(254, 44, 85, 0.1);
    border: 1px solid #fe2c55;
    color: #fe2c55;
}

.tiktok-no-formats-message {
    padding: 24px;
    text-align: center;
    color: #b3b3b3;
    font-style: italic;
    font-size: 14px;
}

/* ==========================================================================
   Results Area
   ========================================================================== */
#tiktok-aio-result {
    min-height: 40px;
    padding: 0 24px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet */
@media (max-width: 768px) {
    .tiktok-aio-downloader-container {
        margin: 16px;
        border-radius: 8px;
    }
    
    .tiktok-aio-header,
    .tiktok-url-input-section,
    .tiktok-format-section {
        padding: 16px;
    }
    
    .tiktok-url-input-group {
        flex-direction: column;
    }
    
    .tiktok-aio-btn {
        width: 100%;
    }
    
    .tiktok-format-tabs {
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    
    .tiktok-format-tab {
        flex: 1;
        min-width: calc(50% - 4px);
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .tiktok-format-grid {
        grid-template-columns: 1fr;
    }
    
    .tiktok-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 300px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .tiktok-aio-downloader-container {
        margin: 8px;
    }
    
    .tiktok-aio-header h3 {
        font-size: 18px;
        gap: 8px;
    }
    
    .tiktok-supported-features {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .tiktok-supported-features span {
        font-size: 11px;
        padding: 3px 6px;
        text-align: center;
    }
    
    .tiktok-format-tab {
        min-width: calc(50% - 4px);
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .tiktok-stats-grid {
        gap: 8px;
    }
    
    .tiktok-stat-item {
        padding: 6px;
    }
}

/* Small Mobile */
@media (max-width: 360px) {
    .tiktok-aio-header h3 {
        font-size: 16px;
    }
    
    .tiktok-supported-features {
        grid-template-columns: 1fr;
    }
    
    .tiktok-format-tab {
        font-size: 10px;
        padding: 5px 8px;
    }
    
    .tiktok-aio-btn {
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .tiktok-stats-grid {
        grid-template-columns: 1fr;
        max-width: 200px;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .tiktok-aio-downloader-container {
        max-width: 900px;
    }
    
    .tiktok-format-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    
    .tiktok-aio-btn:hover,
    .tiktok-format-card:hover,
    .tiktok-format-tab:hover {
        transform: none;
    }
}

/* Светлая тема для TikTok (опционально) */
@media (prefers-color-scheme: light) {
    .tiktok-aio-downloader-container {
        background: #ffffff;
        border-color: #fe2c55;
    }
    
    .tiktok-aio-header,
    .tiktok-url-input-section,
    #tiktok-aio-progress,
    #tiktok-video-info,
    .tiktok-format-tabs,
    .tiktok-format-options {
        background: #ffffff;
        border-color: #e0e0e0;
    }
    
    .tiktok-aio-header h3,
    #tiktok-video-title,
    .tiktok-format-section h5,
    .tiktok-format-label {
        color: #000000;
    }
    
    .tiktok-supported-features span {
        color: #666666;
        border-color: #e0e0e0;
        background: rgba(0, 0, 0, 0.05);
    }
    
    .tiktok-url-input-group input[type="url"] {
        background: #f5f5f5;
        border-color: #e0e0e0;
        color: #000000;
    }
    
    .tiktok-format-tab {
        background: #f5f5f5;
        border-color: #e0e0e0;
        color: #666666;
    }
    
    .tiktok-format-card {
        background: #f5f5f5;
        border-color: #e0e0e0;
    }
    
    .tiktok-format-meta {
        color: #666666;
    }
    
    .tiktok-stat-item {
        background: #f5f5f5;
        border-color: #e0e0e0;
    }
    
    .tiktok-stat-item span {
        color: #666666;
    }
}