/* =============================================
   ระบบฐานข้อมูลบุคลากร — Custom Styles
   ============================================= */

:root {
    --sidebar-width: 240px;
    --primary:       #2563eb;
    --primary-soft:  #dbeafe;
    --success-soft:  #dcfce7;
    --warning-soft:  #fef9c3;
    --info-soft:     #cffafe;
    --border-radius: 0.75rem;
}

/* ── Typography ── */
body {
    font-family: 'Sarabun', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9rem;
    background: #f1f5f9;
    color: #1e293b;
}

/* ── Login Page ── */
.login-bg {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
}
.login-logo {
    width: 72px; height: 72px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
}

/* ── Cards ── */
.card {
    border-radius: var(--border-radius) !important;
}
.card-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

/* ── Stat Cards ── */
.stat-card { transition: transform .15s, box-shadow .15s; cursor: default; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08) !important; }

.stat-icon { width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; }
.bg-primary-soft { background: var(--primary-soft) !important; }
.bg-success-soft { background: var(--success-soft) !important; }
.bg-warning-soft { background: var(--warning-soft) !important; }
.bg-info-soft    { background: var(--info-soft)    !important; }

/* ── Staff Photo Thumbnail ── */
.staff-thumb {
    width: 42px; height: 42px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}
.staff-thumb-placeholder {
    width: 42px; height: 42px;
    background: #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: #94a3b8;
    border: 2px solid #e2e8f0;
}

/* ── DataTable ── */
.dataTables_wrapper .dataTables_filter input {
    border-radius: .5rem;
    border: 1px solid #e2e8f0;
    padding: .3rem .75rem;
    font-size: .875rem;
}
.dataTables_wrapper .dataTables_length select {
    border-radius: .5rem;
    border: 1px solid #e2e8f0;
}
table.dataTable thead tr th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0 !important;
    font-size: .825rem;
    font-weight: 600;
    color: #64748b;
    white-space: nowrap;
}
table.dataTable tbody tr:hover {
    background: #f8fafc !important;
}
table.dataTable tbody td {
    vertical-align: middle;
    font-size: .875rem;
    border-bottom: 1px solid #f1f5f9 !important;
}
.dt-buttons .btn { border-radius: .5rem !important; font-size: .8rem; }

/* ── Form Sections ── */
.section-title {
    border-left: 3px solid var(--primary);
    padding-left: .6rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    font-size: .75rem !important;
}

.form-label-sm, .form-label { font-size: .82rem; margin-bottom: .3rem; color: #475569; }
.form-control, .form-select {
    border-radius: .5rem;
    border-color: #e2e8f0;
    font-size: .875rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── Upload Zone ── */
.upload-zone {
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    cursor: pointer;
    transition: all .2s;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}
.upload-zone.dragover { transform: scale(1.01); }

/* ── Photo Cards ── */
.photo-card {
    border: 2px solid #e2e8f0;
    transition: border-color .2s;
    cursor: default;
}
.photo-card.primary {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34,197,94,.3);
}
.photo-badge {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 3px 8px;
    font-size: .7rem;
    font-weight: 600;
    text-align: center;
}
.photo-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    opacity: 0;
    transition: opacity .2s;
}
.photo-card:hover .photo-overlay { opacity: 1; }

/* ── Navbar ── */
.navbar { backdrop-filter: blur(8px); }
.navbar-brand { font-size: 1rem; }

/* ── Buttons ── */
.btn { font-size: .875rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ═══════════════════════════════════════════
   Education Table (ประวัติการศึกษา)
   ═══════════════════════════════════════════ */

.edu-wrapper {
    border-color: #e2e8f0 !important;
    background: #fff;
}

/* Desktop grid header - Education */
.edu-header {
    display: grid;
    grid-template-columns: 1.6fr 1.6fr 2fr 1fr 52px;
    gap: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: .45rem .75rem;
}

/* Expertise grid header (2 columns + action) */
.exp-header {
    display: grid;
    grid-template-columns: 1fr 1fr 52px;
    gap: 0;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: .45rem .75rem;
}
.exp-header span {
    font-size: .75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 0 .35rem;
}

/* Expertise row */
.exp-row {
    display: grid;
    grid-template-columns: 1fr 1fr 52px;
    align-items: center;
    gap: 0;
    padding: .45rem .75rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}
.exp-row:last-child { border-bottom: none; }
.exp-row:hover      { background: #f8fafc; }

@media (max-width: 767.98px) {
    .exp-row {
        display: block;
        padding: .75rem;
        border-bottom: 2px solid #e2e8f0;
    }
    .exp-header { display: none; }
}
.edu-header span {
    font-size: .75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 0 .35rem;
}

/* Each row — desktop grid */
.edu-row {
    display: grid;
    grid-template-columns: 1.6fr 1.6fr 2fr 1fr 52px;
    align-items: center;
    gap: 0;
    padding: .45rem .75rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}
.edu-row:last-child { border-bottom: none; }
.edu-row:hover      { background: #f8fafc; }
.edu-row.edu-row-new { background: #fffbeb; }
.edu-row.edu-row-new:hover { background: #fef9c3; }

/* Cell padding */
.edu-cell { padding: 0 .35rem; }
.edu-action-cell { padding: 0 .2rem; }

/* Mobile: stack cells */
@media (max-width: 767.98px) {
    .edu-row {
        display: block;
        padding: .75rem;
        border-bottom: 2px solid #e2e8f0;
        border-radius: 0;
    }
    .edu-cell        { padding: .2rem 0; }
    .edu-action-cell { padding: .35rem 0 0; }
}

/* Mobile label */
.edu-mobile-label {
    font-size: .72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: .2rem;
    display: block;
}

/* Footer bar */
.edu-footer {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: .6rem .75rem;
}

/* Empty state */
.edu-empty-msg { padding: 2rem 1rem; }
.edu-empty-msg .opacity-40 { opacity: .4; }

/* Inputs inside edu-row */
.edu-row .form-control-sm {
    font-size: .82rem;
    border-color: transparent;
    background: transparent;
    transition: border-color .15s, background .15s;
    padding: .3rem .5rem;
}
.edu-row .form-control-sm:hover {
    border-color: #e2e8f0;
    background: #fff;
}
.edu-row .form-control-sm:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}

/* Delete button compact */
.edu-action-cell .btn {
    padding: .25rem .4rem;
    font-size: .78rem;
    opacity: .55;
    transition: opacity .15s;
}
.edu-row:hover .edu-action-cell .btn { opacity: 1; }

/* Saved badge */
#eduSavedBadge { animation: fadeSlideIn .3s ease; }
@keyframes fadeSlideIn {
    from { opacity:0; transform: translateY(-4px); }
    to   { opacity:1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 767.98px) {
    body { font-size: .85rem; }
    .card-body { padding: 1rem !important; }
    table.dataTable tbody td { font-size: .8rem; white-space: nowrap; }
    .stat-icon { width: 42px; height: 42px; }
    .btn { font-size: .8rem; }
    .section-title { font-size: .7rem !important; }
}

@media (max-width: 575.98px) {
    .container-fluid { padding-left: .75rem !important; padding-right: .75rem !important; }
}

/* ── Badge overrides ── */
.badge { font-size: .75rem; font-weight: 500; }
.bg-primary-subtle { background: #dbeafe !important; }
.bg-success-subtle { background: #dcfce7 !important; }
.bg-info-subtle    { background: #cffafe !important; }
.bg-secondary-subtle { background: #f1f5f9 !important; }

/* ── View Modal: Education section ── */
.view-section-label {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #94a3b8;
    border-left: 3px solid #2563eb;
    padding-left: .5rem;
    margin-bottom: .5rem;
}
.view-edu-list { display: flex; flex-direction: column; gap: .4rem; }
.view-edu-item {
    background: #f8fafc;
    border-radius: .5rem;
    padding: .5rem .7rem;
    border-left: 3px solid #7c3aed;
}

/* ═══════════════════════════════════════════
   Staff Status Radio Buttons
   ═══════════════════════════════════════════ */

.staff-status-group { display: flex; flex-wrap: wrap; gap: .4rem; }

.status-radio-label {
    display: inline-flex;
    align-items: center;
    padding: .35rem .85rem;
    border-radius: 999px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 500;
    color: #64748b;
    transition: all .15s;
    user-select: none;
}
.status-radio-label input[type="radio"] { display: none; }
.status-radio-label:hover { border-color: #94a3b8; background: #f1f5f9; }

/* Active state per color */
.status-radio-label.status-success.active  { background:#dcfce7; border-color:#22c55e; color:#15803d; }
.status-radio-label.status-warning.active  { background:#fef9c3; border-color:#eab308; color:#854d0e; }
.status-radio-label.status-danger.active   { background:#fee2e2; border-color:#ef4444; color:#991b1b; }
.status-radio-label.status-info.active     { background:#cffafe; border-color:#06b6d4; color:#155e75; }
.status-radio-label.status-dark.active     { background:#f1f5f9; border-color:#334155; color:#0f172a; }
.status-radio-label.status-secondary.active{ background:#f1f5f9; border-color:#64748b; color:#1e293b; }

/* Hover hover per color */
.status-radio-label.status-success:hover  { border-color:#86efac; background:#f0fdf4; }
.status-radio-label.status-warning:hover  { border-color:#fde047; background:#fefce8; }
.status-radio-label.status-danger:hover   { border-color:#fca5a5; background:#fff1f2; }
.status-radio-label.status-info:hover     { border-color:#67e8f9; background:#ecfeff; }
.status-radio-label.status-dark:hover     { border-color:#94a3b8; background:#f8fafc; }
.status-radio-label.status-secondary:hover{ border-color:#94a3b8; background:#f8fafc; }
