/* ============================================
 * style.css — Custom Styles (เฉพาะส่วนที่ Tailwind จัดการไม่ได้)
 * ใช้ร่วมกับ Tailwind CSS CDN
 * ============================================ */

/* ---------- CSS Variables (สำหรับ rgba dynamic classes) ---------- */
:root {
    --guide-rgb: 16, 185, 129;
    --redcross-rgb: 239, 68, 68;
    --bampen-rgb: 59, 130, 246;
    --indigo-rgb: 99, 102, 241;
    --primary-gradient: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
}

/* ---------- Gradient Text ---------- */
.text-gradient-primary {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* ---------- Progress Bar ---------- */
.progress-fill {
    height: 100%;
    border-radius: 0.5rem;
    transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gradient-overall {
    background: var(--primary-gradient);
}

.guide-fill {
    background: #10b981;
}

.redcross-fill {
    background: #ef4444;
}

.bampen-fill {
    background: #3b82f6;
}

/* ---------- Progress Section Top Accent ---------- */
.progress-accent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

/* ---------- Card Selection States (toggled by JS) ---------- */
.card.selected-guide {
    background: rgba(var(--guide-rgb), 0.15) !important;
}

.card.selected-redcross {
    background: rgba(var(--redcross-rgb), 0.15) !important;
}

.card.selected-bampen {
    background: rgba(var(--bampen-rgb), 0.15) !important;
}

/* ---------- Toggle Switch ---------- */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #ef4444;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #10b981;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

/* ---------- Badges (Dynamic Classes — JS สร้าง HTML) ---------- */
.activity-badge,
.log-act-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.activity-badge {
    padding: 0.2rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.82rem;
}

.log-act-badge {
    padding: 0.1rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    margin: 0 0.2rem;
}

.activity-badge.guide,
.log-act-badge.guide {
    background: rgba(var(--guide-rgb), 0.15);
    border: 1px solid rgba(var(--guide-rgb), 0.3);
    color: #10b981;
}

.activity-badge.redcross,
.log-act-badge.redcross {
    background: rgba(var(--redcross-rgb), 0.15);
    border: 1px solid rgba(var(--redcross-rgb), 0.3);
    color: #ef4444;
}

.activity-badge.bampen,
.log-act-badge.bampen {
    background: rgba(var(--bampen-rgb), 0.15);
    border: 1px solid rgba(var(--bampen-rgb), 0.3);
    color: #3b82f6;
}

.activity-badge.none {
    background: rgba(100, 116, 139, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Badge colors สำหรับ admin cards */
.badge.green {
    background: rgba(var(--guide-rgb), 0.15);
    border: 1px solid rgba(var(--guide-rgb), 0.3);
    color: #10b981;
}

.badge.red {
    background: rgba(var(--redcross-rgb), 0.15);
    border: 1px solid rgba(var(--redcross-rgb), 0.3);
    color: #ef4444;
}

.badge.blue {
    background: rgba(var(--bampen-rgb), 0.15);
    border: 1px solid rgba(var(--bampen-rgb), 0.3);
    color: #3b82f6;
}

/* ---------- Filter Buttons (data-attribute selectors) ---------- */
.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border-radius: 9999px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.7);
    font-size: 0.88rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    font-family: 'Kanit', sans-serif;
}

.filter-btn:hover {
    border-color: rgba(var(--indigo-rgb), 0.4);
    background: rgba(var(--indigo-rgb), 0.08);
    color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--indigo-rgb), 0.12);
}

.filter-btn.active {
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.filter-btn.active[data-filter="all"] {
    background: var(--primary-gradient);
}

.filter-btn.active[data-filter="1"] {
    background: linear-gradient(135deg, #059669, #10b981);
}

.filter-btn.active[data-filter="2"] {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.filter-btn.active[data-filter="3"] {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.filter-btn.active[data-filter="0"] {
    background: linear-gradient(135deg, #64748b, #94a3b8);
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.08);
    color: #64748b;
    transition: all 0.25s ease;
}

.filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}

/* ---------- Keyframe Animations ---------- */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.alert-slide-in {
    animation: slideInLeft 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.alert-fade-out {
    animation: fadeOut 0.3s forwards;
}

.modal-scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ---------- Alert Type Variants ---------- */
.alert-success {
    border-left: 4px solid #10b981;
    background: rgba(var(--guide-rgb), 0.08);
    color: #10b981;
}

.alert-error {
    border-left: 4px solid #ef4444;
    background: rgba(var(--redcross-rgb), 0.08);
    color: #ef4444;
}

.alert-info {
    border-left: 4px solid #3b82f6;
    background: rgba(var(--bampen-rgb), 0.08);
    color: #3b82f6;
}

/* ---------- Import Result Variants ---------- */
.import-result {
    display: none;
}

.import-result.success {
    display: block;
    border-left: 4px solid #10b981;
    background: rgba(var(--guide-rgb), 0.08);
    color: #10b981;
    border: 1px solid;
}

.import-result.error {
    display: block;
    border-left: 4px solid #ef4444;
    background: rgba(var(--redcross-rgb), 0.08);
    color: #ef4444;
    border: 1px solid;
}

.import-result.info {
    display: block;
    border-left: 4px solid #3b82f6;
    background: rgba(var(--bampen-rgb), 0.08);
    color: #3b82f6;
    border: 1px solid;
}

/* ---------- Student Table Header Gradient ---------- */
.student-table thead {
    background: var(--primary-gradient);
}

.student-table thead th:first-child {
    border-radius: 11px 0 0 0;
}

.student-table thead th:last-child {
    border-radius: 0 11px 0 0;
}

/* ---------- Log Item Type Backgrounds ---------- */
.log-item.select {
    background: rgba(var(--guide-rgb), 0.15);
}

.log-item.select:hover {
    background: rgba(var(--guide-rgb), 0.22);
}

.log-item.change,
.log-item.admin_change {
    background: rgba(var(--redcross-rgb), 0.15);
}

.log-item.change:hover,
.log-item.admin_change:hover {
    background: rgba(var(--redcross-rgb), 0.22);
}

/* ---------- Admin Badge ---------- */
.admin-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    background: #334155;
    color: #f1f5f9;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}