@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* =========================================================
   SinTast - KALENDER KEGIATAN (kalender.css)
   Dipakai oleh kalender.html. Tampilan HP diatur di bagian bawah
   (dan sedikit di mobile.css).
========================================================= */

/* ---------- Latar halaman ---------- */
body {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    background: #EAF5F6;
    color: #0B4F62;
    -webkit-font-smoothing: antialiased;
}
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(180deg, #cfecef 0, rgba(234, 245, 246, 0) 340px),
        radial-gradient(ellipse 55% 40% at 100% 0%, rgba(0, 140, 145, 0.22), transparent 70%),
        radial-gradient(ellipse 55% 40% at 35% 0%, rgba(32, 196, 199, 0.25), transparent 70%);
}
body::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 170px;
    z-index: -1;
    pointer-events: none;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 220' preserveAspectRatio='none'><path d='M0 90 C90 40 190 20 270 70 C350 120 500 205 760 220 L0 220 Z' fill='%2320C4C7' fill-opacity='.40'/><path d='M0 130 C100 85 190 70 260 115 C340 165 480 212 760 220 L0 220 Z' fill='%23008C91'/><path d='M0 170 C120 150 250 190 420 205 C520 214 640 220 760 220 L0 220 Z' fill='%23006B70'/><path d='M1440 120 C1340 150 1230 195 1000 220 L1440 220 Z' fill='%23008C91'/><path d='M1440 160 C1350 180 1250 205 1120 220 L1440 220 Z' fill='%23006B70'/></svg>") no-repeat bottom / 100% 170px;
}
html::before {
    content: "";
    position: fixed;
    right: 0;
    bottom: 0;
    width: min(640px, 46vw);
    height: 80vh;
    z-index: -1;
    pointer-events: none;
    background: url("assets/gedung.jpg") no-repeat right bottom / auto 100%;
    opacity: 0.92;
    -webkit-mask-image:
        linear-gradient(90deg, transparent 0%, #000 40%),
        linear-gradient(180deg, transparent 0%, #000 25%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(90deg, transparent 0%, #000 40%),
        linear-gradient(180deg, transparent 0%, #000 25%);
    mask-composite: intersect;
}

/* ---------- Halaman ---------- */
.calendar-page {
    position: relative;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 24px 60px;
    box-sizing: border-box;
}

/* Tombol kembali ke menu */
.back-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    padding: 6px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #006B70, #008C91 60%, #14B0B5);
    color: #fff !important;
    font-size: 12px;
    line-height: 1.3;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 107, 112, .28);
    transition: transform .2s, filter .2s;
}
.back-menu-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }

/* Ukuran tombol Kembali: tombol-kembali.js menyuntik CSS ber-!important (padding 11px 24px, font 14px),
   jadi harus ditimpa dengan selector yang lebih spesifik. */
html body .calendar-page .back-menu-btn {
    /* disamakan dengan tombol Kembali di RPK (di RPK tampil 36px karena zoom .86) */
    gap: 7px !important;
    height: 36px !important;
    padding: 0 19px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    margin: 0 0 14px !important;
    box-shadow: 0 5px 14px rgba(0, 107, 112, .30) !important;
}

/* ---------- Banner judul: logo kiri | judul | logo kanan ---------- */
.top-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    background: #fff;
    border-radius: 22px;
    padding: 16px 28px;
    margin: 0 0 14px;
    box-shadow: 0 10px 30px rgba(0, 107, 112, .14);
}
.logo-box { display: flex; align-items: center; min-width: 0; }
.logo-left { justify-content: flex-start; }
.logo-right { justify-content: flex-end; }
.calendar-logo {
    height: 64px !important;
    width: auto !important;
    max-width: 240px !important;
    object-fit: contain;
    display: block;
}
.title-box { text-align: center; min-width: 0; }
.title-box h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    color: #0B5F66;
    letter-spacing: .3px;
    line-height: 1.15;
}
.title-box p {
    margin: 3px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: #2A8F95;
}

/* ---------- Banner bergaya RPK: panel hijau melengkung + logo menyala di kanan ---------- */
.top-header { position: relative; overflow: hidden; }
.title-box { position: relative; z-index: 2; }
.top-header .calendar-logo-left {
    height: 86px !important;
    max-width: 340px !important;
    margin-left: 32px;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 3px 6px rgba(0,107,112,.18));
}
.top-header .logo-right {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: clamp(190px, 24vw, 320px);
    justify-content: center;
    z-index: 1;
}
.top-header .logo-right::before,
.top-header .logo-right::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    border-radius: 100% 0 0 0 / 100% 0 0 0;
}
.top-header .logo-right::before { left: -34px; right: 0; background: rgba(32, 196, 199, .35); }
.top-header .logo-right::after  { left: 0; right: 0; background: linear-gradient(120deg, #20C4C7 0%, #008C91 45%, #006B70 100%); }
.top-header .calendar-logo-right {
    height: 70px !important;
    max-width: 90% !important;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 1.5px #fff) drop-shadow(0 3px 5px rgba(0, 60, 68, .30));
}

/* Garis hias di bawah banner */
.title-line {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0 0 14px;
}
.title-line span {
    display: block;
    width: 110px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, #20C4C7);
}
.title-line span:last-child { background: linear-gradient(270deg, transparent, #20C4C7); }

/* ---------- Nama bulan & tombol navigasi ---------- */
#monthYear {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #0B4F62;
}
.calendar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 0 16px;
}
.calendar-controls button {
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 9px 22px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #14B0B5, #008C91);
    box-shadow: 0 6px 14px rgba(0, 140, 145, .28);
    transition: transform .2s, filter .2s;
}
.calendar-controls button:hover { transform: translateY(-2px); filter: brightness(1.07); }

/* ---------- Kalender ---------- */
.calendar-wrapper {
    background: rgba(255, 255, 255, .92);
    border: 1px solid #fff;
    border-radius: 22px;
    padding: 14px;
    box-shadow: 0 10px 30px rgba(0, 107, 112, .14);
}
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}
.calendar-weekdays > div {
    text-align: center;
    padding: 10px 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #008C91, #14B0B5);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
}
.calendar-weekdays > .sunday,
.calendar-weekdays > .saturday { background: linear-gradient(135deg, #006B70, #008C91); }

#calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    margin-top: 6px;
    /* dipakai kalender.js untuk kartu SPT & kegiatan */
    --spt-pad: 4px 8px 4px 14px;
    --keg-h: 18px;
}

#calendar .day {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 120px;
    min-height: 120px;
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    border: 1px solid #D5EEF0;
    border-radius: 12px;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
#calendar .day:hover {
    border-color: #14B0B5;
    box-shadow: 0 6px 16px rgba(0, 107, 112, .15);
    transform: translateY(-2px);
}
#calendar .day.empty {
    background: rgba(255, 255, 255, .45);
    border-color: transparent;
    cursor: default;
    pointer-events: none;
}
#calendar .day.empty .date-number { color: #9FBFC4; font-weight: 500; }

.date-number {
    flex: 0 0 auto;
    align-self: flex-start;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    color: #0B4F62;
}
#calendar .day.sunday .date-number { color: #D14343; }
#calendar .day.saturday .date-number { color: #006B70; }

#calendar .day.today {
    border: 2px solid #14B0B5;
    background: #F0FBFC;
    box-shadow: 0 0 0 3px rgba(32, 196, 199, .2);
}
#calendar .day.today .date-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 999px;
    background: #008C91;
    color: #fff;
}

/* isi tiap tanggal (kegiatan & SPT) - bisa di-scroll di dalam kotak */
#calendar .day .day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #B7D9DD transparent;
}
#calendar .day .day-events::-webkit-scrollbar { width: 4px; }
#calendar .day .day-events::-webkit-scrollbar-thumb { background: #B7D9DD; border-radius: 4px; }
#calendar .day .event { box-sizing: border-box; max-width: 100%; }

/* ---------- Popup tambah kegiatan (cadangan, tidak tampil sampai dibuka) ---------- */
#eventModal.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 60, 68, .55);
}
#eventModal.modal.show,
#eventModal.modal.active,
#eventModal.modal.open { display: flex; }
#eventModal .modal-content {
    position: relative;
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
    padding: 24px;
    background: #fff;
    border-radius: 18px;
    border-top: 5px solid #008C91;
    box-shadow: 0 20px 50px rgba(0, 60, 68, .30);
}
#eventModal h2 { margin: 0 0 4px; font-size: 19px; color: #0B4F62; }
#eventModal #selectedDate { margin: 0 0 14px; font-size: 12px; color: #426D7B; }
#eventModal label { display: block; margin: 10px 0 5px; font-size: 12px; font-weight: 600; color: #0B4F62; }
#eventModal input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    font-size: 13px;
    border: 1.5px solid #cfe6e8;
    border-radius: 10px;
    background: #f9fdfd;
}
#eventModal .close-modal {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #EAF5F6;
    color: #426D7B;
    font-size: 18px;
    cursor: pointer;
}
#eventModal .modal-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
#eventModal .modal-buttons button {
    border: none;
    border-radius: 999px;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
}
#eventModal .delete-btn { background: linear-gradient(135deg, #ff5a5a, #e63535); }
#eventModal .save-btn { background: linear-gradient(135deg, #14B0B5, #008C91); }

/* ---------- Cetak ---------- */
@media print {
    html::before, body::before, body::after { display: none !important; }
    .back-menu-btn, .calendar-controls { display: none !important; }
}

/* =========================================================
   TAMPILAN HP / TABLET KECIL
========================================================= */
@media (max-width: 800px) {
    html::before { opacity: .35; width: 70vw; }

    .calendar-page { padding: 12px 10px 40px; }

    .back-menu-btn { padding: 7px 16px; font-size: 12px; margin-bottom: 10px; }

    /* banner: logo kiri | judul | logo kanan, ukuran kecil */
    .top-header {
        display: flex;
        justify-content: space-between;
        gap: 8px;
        padding: 10px 12px;
        border-radius: 16px;
        margin-bottom: 10px;
    }
    .calendar-logo { height: 30px !important; max-width: 70px !important; }
    /* HP: tanpa panel melengkung, logo kecil seperti semula */
    .top-header .logo-right { position: static; width: auto; flex: 0 0 auto; }
    .top-header .logo-right::before, .top-header .logo-right::after { display: none; }
    .top-header .calendar-logo-right { height: 30px !important; max-width: 70px !important; filter: none; }
    .top-header .calendar-logo-left { height: 34px !important; max-width: 118px !important; margin-left: 0; filter: none; }
    .title-box { flex: 1 1 auto; }
    .title-box h1 { font-size: 16px; }
    .title-box p { font-size: 11px; margin-top: 1px; }

    .title-line { margin-bottom: 8px; }
    .title-line span { width: 60px; height: 2px; }

    #monthYear { font-size: 18px; letter-spacing: .5px; }
    .calendar-controls { gap: 6px; margin: 6px 0 10px; }
    .calendar-controls button { padding: 7px 12px; font-size: 11px; min-height: 0; }

    .calendar-wrapper { padding: 8px; border-radius: 16px; }
    .calendar-weekdays { gap: 3px; }
    .calendar-weekdays > div { padding: 6px 0; font-size: 10px; letter-spacing: .3px; border-radius: 8px; }

    /* kotak tanggal kecil: kegiatan/SPT jadi batang warna kecil.
       Ketuk tanggal untuk melihat detailnya. */
    #calendar {
        gap: 3px;
        margin-top: 3px;
        --spt-bar: 200px;
        --spt-rad: 4px;
        --spt-h: 7px;
        --spt-pad: 0;
        --keg-h: 7px;
    }
    #calendar .day {
        height: 74px;
        min-height: 74px;
        padding: 4px;
        gap: 3px;
        border-radius: 8px;
    }
    #calendar .day:hover { transform: none; }
    .date-number { font-size: 12px; }
    #calendar .day.today { border-width: 1.5px; box-shadow: none; }
    #calendar .day.today .date-number { min-width: 20px; height: 20px; font-size: 11px; padding: 0 3px; }

    #calendar .day .day-events { gap: 3px; scrollbar-width: none; }
    #calendar .day .day-events::-webkit-scrollbar { display: none; }
    /* kartu SPT: teks disembunyikan; warna status dari --spt-bar (lebar batang) */
    #calendar .day .event-spt > * { display: none !important; }
    #calendar .day .event-kegiatan {
        height: 7px !important;
        min-height: 7px !important;
        padding: 0 !important;
        font-size: 0 !important;
        line-height: 0 !important;
        border-radius: 4px !important;
    }
    #calendar .day .event:not(.event-spt):not(.event-kegiatan) { font-size: 0 !important; padding: 0 !important; height: 7px; }
    #calendar .day .day-events > div:not(.event) { font-size: 7px !important; line-height: 1.1; }
}

/* ---------- Tanda Timker pembuat kegiatan ---------- */
#calendar .day .kg-tk, .kg-tk {
    display: inline-block; max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: #fff; color: #5B21B6; font-size: 8.5px; font-weight: 800; line-height: 13px;
    padding: 0 6px; margin-right: 5px; border-radius: 999px; vertical-align: 1px; box-sizing: border-box;
}
.kg-tk.kg-tk-spt { background: #E6F6F6; color: #0B5F66; border: 1px solid #B7D9DD; margin: 0 0 0 2px; flex: 0 0 auto; }
.kg-tk.kg-tk-kartu { max-width: none; background: #EDE9FE; color: #5B21B6; border: 1px solid #C4B5FD; font-size: 10.5px; line-height: 17px; padding: 0 8px; margin: 0 0 0 6px; vertical-align: baseline; }
@media (max-width: 800px) {
    #calendar .day .kg-tk { display: none !important; }
}