@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-surface: #f1f5f9;
    --bg-elevated: #eef2ff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --border-subtle: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 4px 6px -2px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --glow: 0 0 0 4px rgba(59, 130, 246, 0.08);
    --radius-card: 28px;
    --radius-element: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    background-image: radial-gradient(circle at 0% 30%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
                      radial-gradient(circle at 100% 70%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
    min-height: 100vh;
    padding: 32px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Container chính */
.container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-subtle);
    overflow: hidden;
    backdrop-filter: blur(2px);
}

/* Header */
header {
    padding: 44px 32px 24px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.header-icon {
    font-size: 52px;
    color: var(--accent-primary);
    margin-bottom: 16px;
    filter: drop-shadow(0 6px 8px rgba(59, 130, 246, 0.1));
}

header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
}

header p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Tabs */
.tabs {
    display: flex;
    padding: 0 24px;
    gap: 8px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
    flex: 1;
    padding: 16px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 14px 14px 0 0;
    transition: var(--transition);
    position: relative;
}

.tab-btn i {
    font-size: 1.25rem;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-surface);
}

.tab-btn.active {
    color: var(--accent-primary);
    background: var(--bg-elevated);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 12px var(--accent-primary);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 36px 32px;
    animation: fadeSlide 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-element);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-surface);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
    box-shadow: var(--glow);
    transform: translateY(-2px);
}

.upload-area.drag-over {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
    box-shadow: var(--glow);
    transform: scale(1.01);
}

.upload-area.small {
    padding: 28px 16px;
}

.dual-upload {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.upload-icon {
    font-size: 52px;
    color: var(--accent-primary);
    margin-bottom: 16px;
    opacity: 0.9;
}

.upload-area p {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
}

.upload-area p span {
    color: var(--accent-primary);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.upload-area small {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

/* File list */
.file-info, .file-list {
    margin: 20px 0 28px;
    max-height: 240px;
    overflow-y: auto;
    padding-right: 4px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    margin: 8px 0;
    background: var(--bg-surface);
    border-radius: var(--radius-element);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--accent-primary);
    transition: var(--transition);
    animation: listAppear 0.2s ease;
}

@keyframes listAppear {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

.file-item span:first-child {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.file-item span:last-child {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    background: var(--bg-elevated);
    padding: 4px 12px;
    border-radius: 40px;
}

/* Form Elements */
.split-options {
    margin: 28px 0;
    padding: 20px;
    background: var(--bg-surface);
    border-radius: var(--radius-element);
    border: 1px solid var(--border-subtle);
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 28px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
}

.modern-input {
    width: 100%;
    padding: 14px 18px;
    margin-top: 16px;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-element);
    font-size: 1rem;
    background: white;
    color: var(--text-primary);
    transition: var(--transition);
}

.modern-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.modern-input:disabled {
    opacity: 0.5;
    background: var(--bg-surface);
    cursor: not-allowed;
}

.sign-form {
    margin: 28px 0;
}

.input-group {
    display: flex;
    align-items: center;
    background: white;
    border-radius: var(--radius-element);
    padding: 4px 18px;
    margin-bottom: 14px;
    border: 1.5px solid var(--border-subtle);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.input-group:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: white;
}

.input-group i {
    color: var(--text-tertiary);
    width: 24px;
    font-size: 1.1rem;
}

.input-group input {
    width: 100%;
    padding: 16px 8px;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

.input-group input:focus {
    outline: none;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: 60px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 8px 20px -8px rgba(59, 130, 246, 0.3);
    background-size: 200% 100%;
    background-position: 0% 0%;
}

.btn-primary:hover:not(:disabled) {
    background-position: 100% 0%;
    transform: translateY(-2px);
    box-shadow: 0 12px 25px -8px rgba(139, 92, 246, 0.3);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    filter: grayscale(0.3);
}

/* Loading Overlay */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(59, 130, 246, 0.1);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
}

.loading p {
    color: var(--text-primary);
    margin-top: 24px;
    font-size: 1.2rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== POPUP GIỚI THIỆU ==================== */
.intro-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.intro-popup-content {
    background: white;
    border-radius: 40px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.02);
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.intro-popup-header {
    padding: 36px 32px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
}

.intro-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--accent-gradient);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px -8px rgba(59, 130, 246, 0.3);
    transform: rotate(5deg);
    transition: transform 0.3s ease;
}

.intro-icon i {
    font-size: 44px;
    color: white;
}

.intro-popup:hover .intro-icon {
    transform: rotate(0deg) scale(1.02);
}

.intro-popup-header h2 {
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 6px;
}

.intro-popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-surface);
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-subtle);
}

.intro-popup-close:hover {
    background: var(--accent-primary);
    color: white;
    transform: rotate(90deg);
    box-shadow: var(--shadow-md);
}

.intro-popup-body {
    padding: 28px 32px 20px;
}

.intro-version {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-subtle);
}

.version-badge {
    background: var(--accent-gradient);
    color: white;
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.release-date {
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 500;
}

.intro-section {
    margin-bottom: 28px;
}

.intro-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.intro-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.feature-list {
    list-style: none;
    display: grid;
    gap: 8px;
}

.feature-list li {
    padding: 10px 0;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-primary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-subtle);
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list li i {
    color: var(--accent-primary);
    width: 22px;
    font-size: 1.2rem;
    background: var(--bg-elevated);
    padding: 6px;
    border-radius: 10px;
}

.author-info {
    background: var(--bg-surface);
    padding: 18px 20px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.author-info p {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: var(--text-secondary);
}

.author-info i {
    color: var(--accent-primary);
    width: 24px;
    font-size: 1.2rem;
}

.intro-note {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 14px 18px;
    border-radius: 16px;
    margin-top: 24px;
    color: #92400e;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.intro-note i {
    font-size: 1.5rem;
    color: #f59e0b;
}

.intro-popup-footer {
    padding: 20px 32px 32px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    border-radius: 0 0 40px 40px;
}

.intro-btn {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 60px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-bottom: 18px;
    box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.intro-btn i {
    font-size: 1.2rem;
}

.intro-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px -6px rgba(139, 92, 246, 0.3);
}

.intro-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-tertiary);
    font-size: 0.95rem;
    cursor: pointer;
    user-select: none;
}

.intro-checkbox input {
    accent-color: var(--accent-primary);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: white;
    backdrop-filter: blur(20px);
    padding: 16px 24px;
    border-radius: 60px;
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    color: var(--text-primary);
    pointer-events: auto;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--accent-primary);
}

.toast.success i { color: #10b981; }
.toast.error i { color: #ef4444; }
.toast.warning i { color: #f59e0b; }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 640px) {
    body { padding: 12px; }
    .tabs { padding: 0 12px; }
    .tab-btn span { display: none; }
    .tab-btn i { font-size: 1.6rem; }
    .dual-upload { grid-template-columns: 1fr; }
    .container { border-radius: 20px; }
    .intro-popup-content { border-radius: 28px; }
}

/* Scrollbar tùy chỉnh */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-surface); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-primary); }