/* ==========================================================================
   TaiKhoan.vip - Stylesheet
   Thiết kế chuẩn: Bo góc 0.4em, Tối ưu Mobile & Desktop
   ========================================================================== */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent: #10b981;
    --accent-hover: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --radius: 0.4em;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header & Navbar */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
}

.logo-badge {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    box-shadow: 0 2px 4px rgba(37,99,235,0.25);
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.logo-text h1 span {
    color: var(--primary);
}

.logo-tagline {
    font-size: 12px;
    color: var(--text-muted);
}

.header-badges {
    display: flex;
    gap: 8px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ecfdf5;
    color: #065f46;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid #a7f3d0;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Main Content Container */
.main-wrapper {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 24px auto;
    padding: 0 16px;
}

/* Main Navigation Tabs */
.main-tabs-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #e2e8f0;
    padding: 4px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.main-tab-btn {
    border: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #475569;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.main-tab-btn:hover {
    color: #0f172a;
}

.main-tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Cards */
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.25s ease;
}

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

/* Instruction / Info Banner */
.info-banner {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 13.5px;
}

.info-banner h3 {
    font-size: 14.5px;
    color: #1e293b;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-banner p {
    color: #475569;
    margin-bottom: 4px;
    line-height: 1.5;
}

.info-banner code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #0f172a;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12.5px;
}

.info-banner-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
    color: #92400e;
}

.info-banner-warning h3 {
    color: #b45309;
}

/* Inner sub-tabs */
.sub-tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 18px;
}

.sub-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.sub-tab-btn:hover {
    color: #1e293b;
}

.sub-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Form inputs & buttons */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-textarea,
.form-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 14px;
    color: var(--text-main);
    background: #ffffff;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-textarea {
    resize: vertical;
    min-height: 90px;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
}

.form-textarea:focus,
.form-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.form-hint {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-hint strong {
    color: #334155;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-secondary {
    background: #475569;
}

.btn-secondary:hover {
    background: #334155;
}

/* Loading spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    display: inline-block;
}

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

/* Toast Messages */
.alert-box {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-top: 14px;
    display: none;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

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

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

/* OAuth Result Box */
.oauth-result-box {
    margin-top: 18px;
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius);
    display: none;
}

.oauth-result-title {
    font-size: 14px;
    font-weight: 700;
    color: #166534;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.copy-input-row input {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    font-size: 13px;
    font-family: monospace;
    background: #ffffff;
    color: #0f172a;
}

.copy-btn {
    padding: 9px 16px;
    background: #16a34a;
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s ease;
}

.copy-btn:hover {
    background: #15803d;
}

/* Email List Section */
.email-list-section {
    margin-top: 24px;
    display: none;
}

.email-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.email-list-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.email-badge-count {
    background: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
}

.email-list-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.email-item {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.email-item:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 8px rgba(37,99,235,0.08);
    transform: translateY(-1px);
}

.email-avatar {
    width: 42px;
    height: 42px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.email-main {
    flex: 1;
    min-width: 0;
}

.email-meta-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 3px;
}

.email-sender {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 8px;
}

.email-subject {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-otp-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fee2e2;
    color: #dc2626;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    border: 1px solid #fca5a5;
    margin-top: 2px;
}

.email-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal Popup Chi tiết Email */
.email-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #ffffff;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.4;
    padding-right: 16px;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.modal-close-btn:hover {
    color: #0f172a;
}

.modal-metadata {
    padding: 12px 20px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: #475569;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-metadata-row {
    display: flex;
    gap: 8px;
}

.modal-metadata-row strong {
    color: #1e293b;
    min-width: 45px;
}

.modal-otp-highlight {
    background: #fef2f2;
    border: 1px solid #fecaca;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-otp-code {
    font-size: 22px;
    font-weight: 800;
    color: #dc2626;
    letter-spacing: 2px;
    font-family: monospace;
}

.modal-body {
    padding: 24px 20px;
    overflow-y: auto;
    font-size: 14.5px;
    line-height: 1.6;
    color: #1e293b;
}

.modal-body img {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   2FA GENERATOR STYLING
   ========================================================================== */
.twofa-container {
    text-align: center;
}

.twofa-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.twofa-input {
    flex: 1;
    padding: 13px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text-main);
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.twofa-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.btn-paste {
    padding: 0 16px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.btn-paste:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.twofa-display-card {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 30px 20px;
    margin: 22px 0 16px 0;
    position: relative;
    overflow: hidden;
}

.twofa-code-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.twofa-code {
    font-size: 44px;
    font-weight: 800;
    color: #1e293b;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 6px;
    user-select: all;
    transition: color 0.2s ease;
}

.twofa-code.has-code {
    color: var(--primary);
}

.twofa-copy-icon-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    padding: 8px 12px;
    cursor: pointer;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
}

.twofa-copy-icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: #eff6ff;
}

.twofa-timer-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.twofa-timer-bar {
    width: 140px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.twofa-timer-progress {
    height: 100%;
    background: var(--primary);
    width: 100%;
    transition: width 1s linear, background-color 0.3s ease;
}

.twofa-timer-text {
    font-weight: 700;
    color: #1e293b;
}

/* 2FA Share Link Box */
.twofa-share-box {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-share-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-share-link:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

/* Footer */
.site-footer {
    background: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
    .header-container {
        padding: 12px 16px;
    }
    .logo-text h1 {
        font-size: 18px;
    }
    .main-wrapper {
        margin: 16px auto;
    }
    .tool-card {
        padding: 16px;
    }
    .twofa-code {
        font-size: 32px;
        letter-spacing: 4px;
    }
    .copy-input-row {
        flex-direction: column;
    }
    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}
