/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}
@keyframes pulseRed {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 26, 43, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(139, 26, 43, 0); }
}

.animate-fade-in { animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.animate-slide-in { animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.toast-in { animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
.toast-out { animation: toastOut 0.25s ease-in forwards; }

/* ===== Grid background (matches web) ===== */
.grid-bg {
    background-image:
        linear-gradient(rgba(139,26,43,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139,26,43,0.06) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ===== Nav link ===== */
.nav-link {
    color: rgba(255,255,255,0.55);
}
.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.06);
}
.nav-link.active {
    color: white;
    background: rgba(139, 26, 43, 0.5);
}
.nav-link.active svg {
    opacity: 1;
    color: #C8304D;
}

/* ===== Status badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.badge-new { background: #FEF3C7; color: #92400E; animation: pulseRed 2s infinite; }
.badge-read { background: #EFF6FF; color: #1D4ED8; }
.badge-replied { background: #ECFDF5; color: #047857; }
.badge-archived { background: #F3F4F6; color: #6B7280; }

/* Source badges */
.source-form { background: #F3F4F6; color: #374151; }
.source-whatsapp { background: #ECFDF5; color: #047857; }
.source-telegram { background: #EFF6FF; color: #1D4ED8; }
.source-phone { background: #FFF7ED; color: #C2410C; }
.source-other { background: #F3F4F6; color: #6B7280; }

/* ===== Table ===== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table thead th {
    background: #FAFAFA;
    padding: 14px 16px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888888;
    border-bottom: 1px solid #EFEFEF;
    white-space: nowrap;
    font-family: 'Space Grotesk', system-ui, sans-serif;
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #F5F5F5;
    font-size: 0.875rem;
    color: #444444;
}
.data-table tbody tr {
    transition: background 0.15s;
}
.data-table tbody tr:hover {
    background: #FAFAFA;
}
.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E0E0E0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #8B1A2B; }

/* ===== Form inputs ===== */
input.form-input,
textarea.form-input,
select.form-input,
.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #E0E0E0 !important;
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: 'Inter', system-ui, sans-serif;
    color: #2A2A2A;
    outline: none;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}
input.form-input:focus,
textarea.form-input:focus,
select.form-input:focus,
.form-input:focus {
    border-color: #8B1A2B !important;
    box-shadow: 0 0 0 3px rgba(139, 26, 43, 0.08);
}
.form-input::placeholder {
    color: #C0C0C0;
}
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #444444;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    font-family: 'Space Grotesk', system-ui, sans-serif;
}

/* ===== File Upload Zone ===== */
.file-upload-zone {
    position: relative;
    border: 2px dashed #D5D5D5;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: #FAFAFA;
    overflow: hidden;
}
.file-upload-zone:hover {
    border-color: #8B1A2B;
    background: #FDF2F4;
}
.file-upload-zone.dragover {
    border-color: #8B1A2B;
    background: #FDF2F4;
    border-style: solid;
    transform: scale(1.01);
    box-shadow: 0 0 0 4px rgba(139, 26, 43, 0.08);
}
.file-upload-zone .upload-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 26, 43, 0.08);
    color: #8B1A2B;
    transition: all 0.3s;
}
.file-upload-zone:hover .upload-icon {
    background: #8B1A2B;
    color: white;
    transform: translateY(-2px);
}
.file-upload-zone .upload-text {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 2px;
}
.file-upload-zone .upload-hint {
    font-size: 0.7rem;
    color: #AAA;
}
.file-upload-zone .upload-hint span {
    color: #8B1A2B;
    font-weight: 600;
}
.file-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}
.file-upload-zone.has-file {
    border-style: solid;
    border-color: #047857;
    background: #F0FDF4;
    padding: 12px 16px;
}
.file-upload-zone.has-file .upload-icon {
    background: #047857;
    color: white;
}
.file-upload-zone .file-selected {
    display: flex;
    align-items: center;
    gap: 10px;
}
.file-upload-zone .file-selected .file-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.file-upload-zone .file-selected .file-info {
    text-align: left;
    flex: 1;
    min-width: 0;
}
.file-upload-zone .file-selected .file-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #047857;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-upload-zone .file-selected .file-size {
    font-size: 0.7rem;
    color: #6B7280;
}
.file-upload-zone.compact {
    padding: 14px 12px;
}
.file-upload-zone.compact .upload-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 6px;
}
.file-upload-zone.compact .upload-icon svg {
    width: 16px;
    height: 16px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    border: none;
    letter-spacing: 0.01em;
}
.btn-primary {
    background: #8B1A2B;
    color: white;
}
.btn-primary:hover {
    background: #A82040;
    box-shadow: 0 4px 20px rgba(139, 26, 43, 0.25);
    transform: translateY(-1px);
}
.btn-secondary {
    background: white;
    color: #444444;
    border: 1px solid #E0E0E0;
}
.btn-secondary:hover {
    border-color: #8B1A2B;
    color: #8B1A2B;
    background: #FDF2F4;
}
.btn-danger {
    background: white;
    color: #991B1B;
    border: 1px solid #FECACA;
}
.btn-danger:hover {
    background: #FEF2F2;
    border-color: #EF4444;
}
.btn-sm {
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 8px;
}

/* ===== Stat cards ===== */
.stat-card {
    background: white;
    border: 1px solid #EFEFEF;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8B1A2B, #C8304D);
    opacity: 0;
    transition: opacity 0.3s;
}
.stat-card:hover {
    border-color: rgba(139, 26, 43, 0.15);
    box-shadow: 0 8px 40px rgba(139, 26, 43, 0.06);
    transform: translateY(-2px);
}
.stat-card:hover::before {
    opacity: 1;
}

/* ===== Card base ===== */
.card {
    background: white;
    border: 1px solid #EFEFEF;
    border-radius: 16px;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover {
    border-color: rgba(139, 26, 43, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

/* ===== Red gradient text ===== */
.text-gradient {
    background: linear-gradient(135deg, #C8304D, #8B1A2B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Empty state ===== */
.empty-state {
    padding: 80px 20px;
    text-align: center;
}
.empty-state svg {
    color: #E0E0E0;
}

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

/* ===== Analytics group buttons ===== */
.analytics-group-btn {
    color: #888;
    background: transparent;
    border: none;
    cursor: pointer;
}
.analytics-group-btn:hover {
    color: #444;
}
.analytics-group-btn.active {
    background: white;
    color: #8B1A2B;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ===== Selection ===== */
::selection {
    background-color: #8B1A2B;
    color: white;
}
