/* ============================================
   Attendance Tracking Plugin - Frontend CSS
   ============================================ */

:root {
    --att-primary: #2196F3;
    --att-success: #4CAF50;
    --att-danger: #F44336;
    --att-warning: #FF9800;
    --att-light: #F5F5F5;
    --att-dark: #333333;
    --att-border: #DDDDDD;
    --att-radius: 8px;
    --att-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   ATTENDANCE CARDS GRID
   ============================================ */

.att-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px 0;
}

@media (max-width: 900px) {
    .att-cards-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .att-cards-container {
        grid-template-columns: 1fr;
    }
}

.att-card {
    background: white;
    border-radius: var(--att-radius);
    box-shadow: var(--att-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.att-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.att-card__photo {
    width: 100%;
    overflow: hidden;
    background: var(--att-light);
}

/* Foto full-width mengikuti lebar kartu, dibuat lebih tinggi ~25%
   dari sebelumnya supaya wajah lebih jelas kelihatan */
.att-card__photo--portrait {
    width: 100%;
    aspect-ratio: 6 / 5;
}

.att-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.att-card__photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--att-success, #4CAF50);
    color: #fff;
    font-size: 40px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Bar status full-width di bawah foto — teks PUTIH dipaksa (important)
   supaya tetap kontras jelas walau ada CSS tema yang ikut mengatur warna teks */
.att-card__status-bar {
    padding: 12px 16px;
    text-align: center;
    color: #ffffff !important;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.att-card__status-bar.att-status-hadir { background: var(--att-success, #4CAF50); }
.att-card__status-bar.att-status-tugas_luar { background: #2196F3; }
.att-card__status-bar.att-status-cuti { background: #F44336; }
.att-card__status-bar.att-status-istirahat { background: #FF9800; }
.att-card__status-bar.att-status-kosong { background: #9e9e9e; }

.att-card__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.att-card__name {
    margin: 0 0 6px 0;
    font-size: 19px;
    font-weight: 800;
    color: var(--att-dark);
}

.att-card__nidn {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #777777;
}

.att-card__notes-block {
    margin: 12px 0;
    padding: 12px 14px;
    background: var(--att-light, #f5f5f5);
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.6;
    color: #444444;
}

.att-card__update-time {
    margin: 10px 0 0 0;
    margin-top: auto;
    padding-top: 10px;
    font-size: 11px;
    color: #999999;
}

.att-card__footer {
    padding: 12px 16px;
    border-top: 1px solid var(--att-border);
    text-align: center;
}

/* ============================================
   FORMS
   ============================================ */

.att-form-container {
    max-width: 600px;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: var(--att-radius);
    box-shadow: var(--att-shadow);
}

.att-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.att-form__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.att-form__label {
    font-weight: 600;
    color: var(--att-dark);
    font-size: 14px;
}

.att-required {
    color: var(--att-danger);
}

.att-form__input {
    padding: 12px;
    border: 1px solid var(--att-border);
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background: #ffffff !important;
    color: #333333 !important;
}

.att-form__input:focus {
    outline: none;
    border-color: var(--att-primary);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

textarea.att-form__input {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   SIGNATURE PAD
   ============================================ */

.att-signature-pad-container {
    border: 2px solid var(--att-border);
    border-radius: 4px;
    padding: 16px;
    background: var(--att-light);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#att-signature-pad {
    display: block;
    border: 1px solid var(--att-border);
    border-radius: 4px;
    background: white;
    cursor: crosshair;
    width: 100%;
    height: 200px;
}

/* ============================================
   BUTTONS
   ============================================ */

.att-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.att-btn--primary {
    background: var(--att-primary);
    color: white;
}

.att-btn--primary:hover {
    background: #1976D2;
    transform: translateY(-2px);
}

.att-btn--primary:active {
    transform: translateY(0);
}

.att-btn--secondary {
    background: var(--att-light);
    color: var(--att-dark);
    border: 1px solid var(--att-border);
}

.att-btn--secondary:hover {
    background: #EEEEEE;
}

.att-btn--update {
    background: var(--att-primary);
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.att-btn--update:hover {
    background: #1976D2;
}

/* ============================================
   DASHBOARD
   ============================================ */

.att-dashboard {
    padding: 20px;
    background: white;
    border-radius: var(--att-radius);
    box-shadow: var(--att-shadow);
    margin-top: 25px;
}

.att-dashboard h2 {
    margin-top: 0;
    color: var(--att-dark);
}

.att-dashboard__stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.att-stat {
    padding: 20px;
    background: var(--att-light);
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--att-primary);
}

.att-stat__value {
    font-size: 32px;
    font-weight: 700;
    color: var(--att-primary);
}

.att-stat__label {
    font-size: 12px;
    color: #666666;
    text-transform: uppercase;
    margin-top: 8px;
}

/* ============================================
   TABLES
   ============================================ */

.att-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.att-table thead {
    background: var(--att-light);
}

.att-table th,
.att-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--att-border);
    font-size: 14px;
}

.att-table th {
    font-weight: 600;
    color: var(--att-dark);
}

.att-table tbody tr:hover {
    background: var(--att-light);
}

/* ============================================
   STATUS BADGES
   ============================================ */

.att-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.att-status-hadir {
    background: rgba(76, 175, 80, 0.2);
    color: #2E7D32;
}

.att-status-tugas_luar {
    background: rgba(33, 150, 243, 0.2);
    color: #1565C0;
}

.att-status-cuti {
    background: rgba(244, 67, 54, 0.2);
    color: #C62828;
}

.att-status-istirahat {
    background: rgba(255, 152, 0, 0.2);
    color: #E65100;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .att-cards-container {
        grid-template-columns: 1fr;
    }

    .att-dashboard__stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .att-form-container {
        padding: 16px;
    }

    .att-card {
        margin-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .att-form-container {
        padding: 12px;
    }

    .att-btn {
        width: 100%;
    }

    .att-table {
        font-size: 12px;
    }

    .att-table th,
    .att-table td {
        padding: 8px;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.att-hidden {
    display: none;
}

.att-loading {
    opacity: 0.6;
    pointer-events: none;
}

.att-error {
    color: var(--att-danger);
    font-size: 14px;
    margin-top: 8px;
}

.att-success {
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid var(--att-success);
    padding: 12px;
    border-radius: 4px;
    color: #2E7D32;
    margin-bottom: 16px;
}

/* Phase 3: Status kehadiran terkini di atas form */
.att-current-status {
    background: #f0f6fc;
    border: 1px solid #c3d9ec;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #333;
}

/* Phase 3: Prompt login untuk shortcode yang butuh login */
.att-login-required {
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: left;
}

.att-login-required p {
    margin-bottom: 15px;
    color: #555;
}

.att-login-required form p {
    margin-bottom: 12px;
}

.att-login-required label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.att-login-required input[type="text"],
.att-login-required input[type="password"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.att-login-required input[type="submit"] {
    background: var(--att-success, #4CAF50);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.att-login-required input[type="submit"]:hover {
    opacity: 0.9;
}

/* ===== Phase 3.5: Portal Staf (menu, tab, biodata) ===== */

.att-portal {
    max-width: 900px;
    margin: 0 auto;
}

.att-portal__topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 20px;
    background: #fff;
    border-radius: var(--att-radius, 8px);
    box-shadow: var(--att-shadow, 0 1px 3px rgba(0,0,0,0.1));
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.att-portal__identity {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.att-portal__photo {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
}

.att-portal__photo img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.att-portal__photo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--att-success, #4CAF50);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
}

.att-portal__user strong {
    display: inline;
    font-size: 16px;
}

.att-portal__name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.att-status-capsule {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.att-status-capsule.att-status-hadir { background: var(--att-success, #4CAF50); }
.att-status-capsule.att-status-tugas_luar { background: #2196F3; }
.att-status-capsule.att-status-cuti { background: #F44336; }
.att-status-capsule.att-status-istirahat { background: #FF9800; }
.att-status-capsule.att-status-kosong { background: #9e9e9e; }

.att-portal__role {
    display: block;
    font-size: 13px;
    color: #777;
    margin-top: 2px;
}

.att-portal__note-box {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f7f7f7;
    border: 1px solid #ececec;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
    max-width: 400px;
}

.att-portal__note-box em {
    color: #999;
}

.att-portal__ubah-status-btn {
    display: inline-block;
    margin-top: 10px;
}

.att-portal__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 0;
}

.att-portal__nav-item {
    display: inline-block;
    padding: 10px 16px;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}

.att-portal__nav-item:hover {
    color: var(--att-success, #4CAF50);
}

.att-portal__nav-item.active {
    color: var(--att-success, #4CAF50);
    border-bottom-color: var(--att-success, #4CAF50);
}

.att-portal__content {
    background: #fff;
    border-radius: var(--att-radius, 8px);
    box-shadow: var(--att-shadow, 0 1px 3px rgba(0,0,0,0.1));
    padding: 20px;
}

.att-portal__hint {
    font-size: 13px;
    color: #888;
    margin-top: 15px;
}

.att-notice {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

.att-notice--success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
}

.att-notice--error {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    color: #c62828;
}

.att-biodata-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.att-biodata-subnav .att-portal__nav-item {
    background: #f5f5f5;
    border-radius: 20px;
    border-bottom: none;
    padding: 6px 14px;
    font-size: 13px;
}

.att-biodata-subnav .att-portal__nav-item.active {
    background: var(--att-success, #4CAF50);
    color: #fff;
}

.att-table__actions a {
    text-decoration: none;
}

.att-text-danger {
    color: #c62828 !important;
}

.att-current-status-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    margin-bottom: 15px;
}

.att-current-status-card__status {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    margin-bottom: 10px;
}

.att-current-status-card__status.att-status-hadir { background: var(--att-success, #4CAF50); }
.att-current-status-card__status.att-status-tugas_luar { background: #2196F3; }
.att-current-status-card__status.att-status-cuti { background: #F44336; }
.att-current-status-card__status.att-status-istirahat { background: #FF9800; }

.att-current-status-card__time {
    color: #777;
    font-size: 13px;
    margin: 5px 0;
}

.att-current-status-card__notes {
    color: #555;
    font-size: 14px;
    margin-bottom: 15px;
}

.att-filter-form {
    background: #fafafa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.att-filter-form__row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.att-filter-form__row .att-form__group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

.att-filter-form__submit {
    flex: 0 0 auto;
}

.att-btn--small {
    padding: 6px 14px;
    font-size: 13px;
}

@media (max-width: 600px) {
    .att-portal__nav {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .att-filter-form__row {
        flex-direction: column;
        align-items: stretch;
    }
}

.att-portal__divider {
    margin: 30px 0;
    border: none;
    border-top: 1px solid #eee;
}

/* ===== Phase 3.6: WYSIWYG sederhana untuk catatan kehadiran ===== */

.att-richtext-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f5f5f5 !important;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 6px 8px;
    position: relative;
    flex-wrap: wrap;
}

.att-richtext-btn,
.att-emoji-toggle {
    background: #ffffff !important;
    color: #333333 !important;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.4;
}

.att-richtext-btn:hover,
.att-emoji-toggle:hover {
    background: #eeeeee !important;
}

.att-richtext-sep {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 4px;
}

.att-emoji-picker {
    display: none;
    position: absolute;
    top: 100%;
    left: 8px;
    z-index: 10;
    background: #ffffff !important;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    padding: 8px;
    margin-top: 4px;
    max-width: 220px;
    flex-wrap: wrap;
    gap: 4px;
}

.att-emoji-picker.is-open {
    display: flex;
}

.att-emoji-item {
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.att-emoji-item:hover {
    background: #f0f0f0;
}

.att-richtext-editor {
    min-height: 100px;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 0 0 6px 6px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    background: #ffffff !important;
    color: #333333 !important;
}

.att-richtext-editor:focus {
    outline: none;
    border-color: var(--att-success, #4CAF50);
}

.att-richtext-editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
}

.att-richtext-editor ul {
    margin: 0 0 0 20px;
    padding: 0;
}

/* textarea sumber disembunyikan — cuma dipakai buat nyimpen data
   sebelum dikirim, tampilan aslinya ada di .att-richtext-editor */
.att-richtext-source {
    display: none;
}

.att-card__inline-form {
    margin-top: 12px;
    text-align: left;
}

.att-card__inline-form .att-form-container {
    box-shadow: none;
    padding: 0;
}

/* Data SINTA di tab Pengaturan */
.att-sinta-box {
    margin-top: 25px;
    padding: 18px 20px;
    background: #f7f9fc;
    border: 1px solid #e0e6f0;
    border-radius: 8px;
}

.att-sinta-box h3 {
    margin-top: 0;
}

.att-sinta-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.att-sinta-stat {
    text-align: center;
    background: #fff;
    border-radius: 8px;
    padding: 12px 8px;
    border: 1px solid #eee;
}

.att-sinta-stat__value {
    font-size: 22px;
    font-weight: 800;
    color: var(--att-success, #4CAF50);
}

.att-sinta-stat__label {
    font-size: 12px;
    color: #777;
    margin-top: 4px;
}

/* Bidang keahlian (dari sync SINTA) di kartu kehadiran */
.att-card__subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.att-card__subject-tag {
    display: inline-block;
    background: #eef1fb;
    color: #020381;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 10px;
}

/* Bidang Kompetensi/Keahlian di Dashboard (dari sync SINTA) */
.att-sinta-subjects {
    margin-top: 16px;
}

.att-sinta-subjects__title {
    font-size: 14px;
    font-weight: 700;
    color: #444;
    margin: 0 0 8px 0;
}

.att-sinta-subjects__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.att-sinta-subjects__tag {
    display: inline-block;
    background: #eef1fb;
    color: #020381;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
}

/* Bidang Kompetensi di topbar Portal (antara peran dan keterangan) */
.att-portal__subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 6px 0;
}

.att-portal__subject-tag {
    display: inline-block;
    background: #eef1fb;
    color: #020381;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 10px;
}
