/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(139, 92, 246, 0.5);
    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.15);
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --error: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== App Container ===== */
.app {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0 32px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #6d28d9);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.btn-settings {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-settings:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-glow);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-card);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition);
    outline: none;
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-outline {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-glow);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.82rem;
}

/* ===== Setup Banner ===== */
.setup-banner {
    text-align: center;
    padding: 40px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.setup-banner.hidden {
    display: none;
}

.setup-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.setup-banner p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* ===== Drop Zone ===== */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-card);
    margin-bottom: 24px;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: scale(1.01);
    box-shadow: 0 0 40px var(--accent-glow);
}

.drop-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
    transition: color var(--transition);
}

.drop-zone:hover .drop-icon,
.drop-zone.dragover .drop-icon {
    color: var(--accent-light);
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.drop-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Upload Card ===== */
.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    animation: slideIn 0.3s ease;
}

.upload-info {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.upload-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    background: var(--accent-glow);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 350px;
}

.upload-size {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.upload-status {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.upload-status.error {
    color: var(--error);
}

/* ===== Result Card ===== */
.result-card {
    background: var(--bg-card);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    animation: slideIn 0.3s ease;
}

.result-header {
    margin-bottom: 14px;
}

.result-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--success-bg);
    color: var(--success);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.result-url-box {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.result-url {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent-light);
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 0.82rem;
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-copy {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-copy:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-glow);
}

.btn-copy.copied {
    border-color: var(--success);
    color: var(--success);
    background: var(--success-bg);
}

.result-actions {
    display: flex;
    gap: 10px;
}

/* ===== History ===== */
.history-section {
    padding-top: 8px;
}

.history-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.history-item:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: var(--bg-card-hover);
}

.history-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-name {
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-icon {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 0.85rem;
}

.btn-icon:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--accent-glow);
}

.btn-icon.delete:hover {
    border-color: var(--error);
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.history-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* ===== Hidden ===== */
.hidden {
    display: none !important;
}

/* ===== Animations ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 200;
    transition: transform 0.3s ease;
    white-space: nowrap;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .app {
        padding: 0 16px;
    }
    
    .header {
        padding: 16px 0 24px;
    }
    
    .drop-zone {
        padding: 36px 16px;
    }
    
    .upload-name {
        max-width: 200px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn-sm {
        width: 100%;
        text-align: center;
    }
}
