/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #0a0a0f;
    min-height: 100vh;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 480px;
    width: 100%;
    background: #12121a;
    border-radius: 20px;
    border: 1px solid #1e1e2a;
    padding: 20px 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* ========== HEADER ========== */
.header {
    text-align: center;
    padding: 4px 0 16px 0;
}

.header .logo {
    font-size: 36px;
    display: block;
    margin-bottom: 2px;
}

.header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.header .sub {
    color: #666;
    font-size: 13px;
    margin-top: 2px;
}

.header .badge {
    display: inline-block;
    background: #1a1a2a;
    color: #888;
    font-size: 10px;
    padding: 3px 12px;
    border-radius: 20px;
    margin-top: 6px;
    letter-spacing: 0.3px;
}

/* ========== TOGGLE ========== */
.toggle-group {
    display: flex;
    background: #1a1a2a;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 14px;
}

.toggle-group .toggle-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #666;
    touch-action: manipulation;
}

.toggle-group .toggle-btn.active {
    background: #2a2a3a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.toggle-group .toggle-btn:active {
    transform: scale(0.96);
}

/* ========== INPUT ========== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.input-group input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 1.5px solid #1e1e2a;
    border-radius: 12px;
    background: #0d0d15;
    color: #eee;
    outline: none;
    transition: border-color 0.3s ease;
}

.input-group input[type="text"]:focus {
    border-color: #4a4a6a;
}

.input-group input[type="text"]::placeholder {
    color: #444;
}

.input-group button {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    background: #2a2a4a;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.input-group button:active {
    transform: scale(0.97);
    background: #3a3a5a;
}

.input-group button:disabled {
    opacity: 0.5;
    transform: none;
}

/* ========== VIDEO INFO ========== */
.video-info {
    background: #0d0d15;
    border-radius: 14px;
    padding: 14px;
    margin-top: 14px;
    display: none;
    border: 1px solid #1a1a2a;
}

.video-info img {
    width: 100%;
    border-radius: 10px;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #0a0a0f;
    margin-bottom: 10px;
}

.video-info .title {
    font-size: 16px;
    font-weight: 600;
    color: #eee;
    margin-bottom: 2px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-info .channel {
    font-size: 13px;
    color: #888;
    margin-bottom: 2px;
}

.video-info .duration {
    font-size: 12px;
    color: #555;
    margin-bottom: 12px;
}

.video-info #download-btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    background: #2a2a4a;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.video-info #download-btn:active {
    transform: scale(0.97);
    background: #3a3a5a;
}

/* ========== PROGRESS ========== */
.progress {
    margin-top: 14px;
    display: none;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #1a1a2a;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4a4a7a;
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress .status {
    margin-top: 6px;
    text-align: center;
    color: #666;
    font-size: 12px;
}

/* ========== MESSAGES ========== */
.message {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    display: none;
}

.message.error {
    display: block;
    background: rgba(200, 60, 60, 0.12);
    color: #cc6666;
    border: 1px solid rgba(200, 60, 60, 0.15);
}

.message.success {
    display: block;
    background: rgba(60, 200, 120, 0.10);
    color: #66cc99;
    border: 1px solid rgba(60, 200, 120, 0.12);
}

.message .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.message .actions a,
.message .actions span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.message .actions .download-link {
    background: #2a2a4a;
    color: #eee;
}

.message .actions .delete-link {
    background: rgba(200, 60, 60, 0.10);
    color: #cc6666;
}

.message .actions a:active,
.message .actions span:active {
    transform: scale(0.96);
}

/* ========== FILE LIST ========== */
.file-list {
    margin-top: 14px;
    background: #0d0d15;
    border-radius: 14px;
    padding: 14px;
    border: 1px solid #1a1a2a;
    display: none;
}

.file-list h3 {
    color: #666;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.file-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid #14141e;
}

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

.file-item .file-name {
    color: #aaa;
    font-size: 13px;
    word-break: break-all;
}

.file-item .file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.file-item .file-actions a,
.file-item .file-actions span {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.file-item .file-actions .download-small {
    background: rgba(60, 60, 100, 0.15);
    color: #8888cc;
}

.file-item .file-actions .delete-small {
    background: rgba(200, 60, 60, 0.08);
    color: #cc6666;
}

.file-item .file-actions a:active,
.file-item .file-actions span:active {
    transform: scale(0.95);
}

/* ========== LOADER ========== */
.loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: #aaa;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    flex-shrink: 0;
}

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

/* ========== RESPONSIVE ========== */
@media (max-width: 420px) {
    body { padding: 10px; }
    .container { padding: 14px 12px; }
    .header h1 { font-size: 19px; }
    .header .logo { font-size: 30px; }
    .input-group input[type="text"] { font-size: 14px; padding: 12px 14px; }
    .input-group button { font-size: 14px; padding: 12px; }
    .video-info .title { font-size: 15px; }
    .message .actions { flex-direction: column; }
    .message .actions a,
    .message .actions span { justify-content: center; }
}

@media (max-width: 360px) {
    .container { padding: 10px 8px; }
    .header h1 { font-size: 17px; }
    .toggle-group .toggle-btn { font-size: 12px; padding: 8px; }
}
