@import url(https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap);

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Google Sans", "Product Sans", "Inter", system-ui, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
}

/* Hiệu ứng email khi hover */
.email-item {
    transition: background-color 0.15s ease;
}

/* Giới hạn dòng */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Thanh cuộn tùy chỉnh */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Bỏ outline mặc định */
input:focus, select:focus, button:focus {
    outline: none;
}

/* Hiệu ứng email mới */
.email-item-enter {
    opacity: 0;
    transform: translateY(8px);
}

.email-item-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s, transform 0.3s;
}

/* Hiệu ứng modal */
#email-modal {
    transition: opacity 0.2s ease;
}

#email-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

#email-modal:not(.hidden) {
    opacity: 1;
}

/* ===== Email History Feature ===== */

/* Floating history button */
.history-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 80;
    width: 46px;
    height: 46px;
    border-radius: 18px;
    background: linear-gradient(135deg, #3abd6a 0%, #17a84c 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35), 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
}
.history-fab:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 24px rgba(22, 163, 74, 0.4), 0 4px 10px rgba(0,0,0,0.1);
}
.history-fab:active {
    transform: translateY(0) scale(0.97);
}
.history-fab .fab-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 6px;
    border-radius: 10px;
    background: #ea4f4f;
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    line-height: 1;
    transition: transform 0.2s ease;
}
.history-fab .fab-badge.hidden { display: none; }
.history-fab .fab-badge:not(.hidden) {
    animation: badgePop 0.3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes badgePop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

/* History drawer overlay */
.history-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.history-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* History drawer panel */
.history-drawer {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 95;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    background: white;
    /* border-radius: 20px 20px 0 0; */
    box-shadow: 0 -8px 32px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(.4,0,.2,1);
}
.history-drawer.active {
    transform: translateY(0);
}

/* Desktop: slide from right */
@media (min-width: 641px) {
    .history-drawer {
        top: 0;
        bottom: 0;
        right: 0;
        max-height: 100vh;
        /* border-radius: 20px 0 0 20px; */
        transform: translateX(100%);
    }
    .history-drawer.active {
        transform: translateX(0);
    }
}

/* Drawer header */
.history-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.history-drawer-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-drawer-header h3 i {
    color: #16a34a;
}
.history-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.history-drawer-close:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Drawer body - list */
.history-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}
.history-drawer-body::-webkit-scrollbar { width: 4px; }
.history-drawer-body::-webkit-scrollbar-track { background: transparent; }
.history-drawer-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }

/* Empty history state */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    text-align: center;
}
.history-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.history-empty-icon i {
    font-size: 22px;
    color: #cbd5e1;
}
.history-empty p {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

/* History item card */
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    cursor: default;
    transition: all 0.2s ease;
    animation: historyItemIn 0.3s ease-out both;
}
.history-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}
.history-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}
.history-item-info {
    flex: 1;
    min-width: 0;
}
.history-item-email {
    font-size: 13.5px;
    font-weight: 500;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.history-item-time i {
    font-size: 10px;
}
.history-item-use {
    flex-shrink: 0;
    height: 28px;
    padding: 0 12px;
    border-radius: 8px;
    border: none;
    background: #22c55e;
    color: white;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.history-item-use:hover {
    background: #16a34a;
    transform: scale(1.03);
}
.history-item-use:active {
    transform: scale(0.97);
}

/* History item delete */
.history-item-delete {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    font-size: 12px;
}
.history-item-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Drawer footer */
.history-drawer-footer {
    padding: 12px 16px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.history-clear-btn {
    width: 100%;
    height: 38px;
    border-radius: 12px;
    border: 1px solid #fee2e2;
    background: #fff5f5;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.history-clear-btn:hover {
    background: #fee2e2;
    border-color: #fecaca;
}

/* Animation for items */
@keyframes historyItemIn {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .history-fab {
        bottom: 18px;
        right: 16px;
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }
    .history-drawer {
        max-width: 100%;
        max-height: 75vh;
    }
}
