/**
 * TeraBox Downloader Stylesheet
 * Prefix: tbdl-
 */

/* Container & Base Card */
.tbdl-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 720px;
    margin: 24px auto;
    box-sizing: border-box;
}

.tbdl-container *, 
.tbdl-container *::before, 
.tbdl-container *::after {
    box-sizing: border-box;
}

.tbdl-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #eef2f6;
    padding: 28px;
    transition: all 0.3s ease;
}

/* Header */
.tbdl-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.tbdl-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.tbdl-header-text {
    flex: 1;
}

.tbdl-title {
    margin: 0 0 4px 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

.tbdl-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.4;
}

/* Input Form */
.tbdl-form {
    margin-bottom: 20px;
}

.tbdl-input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 640px) {
    .tbdl-input-group {
        flex-direction: row;
    }
}

.tbdl-input {
    flex: 1;
    height: 50px;
    padding: 0 18px;
    font-size: 0.95rem;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tbdl-input:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* Primary Button */
.tbdl-button {
    height: 50px;
    padding: 0 24px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.tbdl-button:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.tbdl-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.tbdl-button:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

/* Spinner Icon */
.tbdl-btn-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
}

.tbdl-spinner-icon {
    animation: tbdl-rotate 1.4s linear infinite;
    width: 100%;
    height: 100%;
}

.tbdl-spinner-icon .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: tbdl-dash 1.4s ease-in-out infinite;
}

@keyframes tbdl-rotate {
    100% { transform: rotate(360deg); }
}

@keyframes tbdl-dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Alerts */
.tbdl-alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: tbdl-fadeIn 0.3s ease;
}

.tbdl-alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.tbdl-alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.tbdl-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Result Area */
.tbdl-result {
    margin-top: 24px;
    animation: tbdl-fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes tbdl-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Media Card */
.tbdl-media-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

/* Player Wrapper */
.tbdl-player-wrapper {
    position: relative;
    width: 100%;
    background: #000000;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    overflow: hidden;
}

.tbdl-video-player {
    width: 100%;
    max-height: 420px;
    display: block;
    outline: none;
}

/* Image Preview */
.tbdl-image-wrapper {
    width: 100%;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    max-height: 420px;
    overflow: hidden;
}

.tbdl-image-preview {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* File Details Body */
.tbdl-file-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 520px) {
    .tbdl-file-body {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.tbdl-file-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.tbdl-file-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #e0e7ff;
    color: #3730a3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tbdl-file-info {
    min-width: 0;
}

.tbdl-file-name {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tbdl-file-size {
    margin: 0;
    font-size: 0.825rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tbdl-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: #e2e8f0;
    color: #475569;
}

.tbdl-download-action {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tbdl-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #16a34a;
    color: #ffffff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.tbdl-download-btn:hover {
    background: #15803d;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35);
}

.tbdl-btn-secondary {
    background: #475569;
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.25);
}

.tbdl-btn-secondary:hover {
    background: #334155;
    box-shadow: 0 6px 16px rgba(71, 85, 105, 0.35);
}
