* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: Arial, sans-serif;
    background: #0b0f14;
    color: #fff;
}

body { user-select: none; }

/* =========================
   BASE LAYOUT - LANDSCAPE
========================= */

.app-shell {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    display: grid;
    grid-template-rows: 90px minmax(0, 1fr) 56px;
    overflow: hidden;
    background: #0b0f14;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: linear-gradient(90deg, #f7d358, #f1c40f, #c9a227);
    color: #111;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    background: rgba(255,255,255,0.35);
    border-radius: 14px;
    padding: 4px;
}

.brand-text h1 {
    font-size: 28px;
    line-height: 1.1;
    font-weight: 700;
}

.subtitle {
    font-size: 15px;
    font-weight: 600;
    opacity: 0.9;
}

.screen-meta {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.85;
}

.clock-box {
    text-align: right;
    flex-shrink: 0;
}

#clock {
    font-size: 34px;
    font-weight: 700;
    line-height: 1;
}

#todayDate {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 600;
}

.main-layout {
    display: grid;
    grid-template-columns: 2.1fr 1fr;
    gap: 16px;
    padding: 16px;
    min-height: 0;
    overflow: hidden;
}

.hero-panel,
.side-panel,
.panel-card,
.panel-content {
    min-height: 0;
}

.slides-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}

.slide-item {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .8s ease, visibility .8s ease;
    background: #111;
}

.slide-item.active {
    opacity: 1;
    visibility: visible;
}

.slide-item img,
.slide-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #000;
}

.side-panel {
    display: grid;
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    overflow: hidden;
}

.panel-card {
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
    overflow: hidden;
}

.panel-title {
    flex-shrink: 0;
    padding: 16px 18px;
    font-size: 21px;
    font-weight: 700;
    background: linear-gradient(90deg, rgba(241,196,15,.95), rgba(241,196,15,.65));
    color: #111;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    position: relative;
}

.notice-row,
.meeting-row {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.notice-title,
.meeting-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.notice-content {
    font-size: 14px;
    opacity: 0.88;
    line-height: 1.5;
}

.meeting-time {
    display: inline-block;
    margin-bottom: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(241,196,15,0.18);
    color: #ffd95e;
    font-size: 13px;
    font-weight: 700;
}

.meeting-meta,
.meeting-submeta {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.88;
}

.active-meeting {
    background: rgba(220, 38, 38, 0.18);
    border-left: 5px solid #dc2626;
    border-radius: 14px;
    margin: 8px;
    border-bottom: none;
}

.now-label-inline {
    display: inline-block;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 999px;
    margin-bottom: 8px;
    animation: blinkNow 1.2s infinite alternate;
}

@keyframes blinkNow {
    from { opacity: 0.65; }
    to { opacity: 1; }
}

/* Empty state */

.no-display-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 90%;
    text-align: center;
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    opacity: 0.85;
}

.no-display-message::before {
    content: "📢";
    display: block;
    font-size: 40px;
    margin-bottom: 10px;
}

#announcementList.centered,
#meetingList.centered {
    display: flex;
    align-items: center;
    justify-content: center;
}

#announcementList.centered .empty-list,
#meetingList.centered .empty-list {
    text-align: center;
    font-size: 22px;
    opacity: 0.85;
    max-width: 80%;
}

/* Ticker */

.ticker-bar {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
    background: #030507;
    border-top: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
}

.ticker-label {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #f7d358, var(--theme-color));
    color: #111;
    font-weight: 800;
    font-size: 18px;
}

.ticker-window {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.ticker-text {
    display: inline-block;
    padding-left: 100%;
    font-size: 20px;
    font-weight: 600;
    animation: tickerScroll 35s linear infinite;
}

@keyframes tickerScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

/* =========================
   PORTRAIT 9:16 FINAL
========================= */

body.portrait-mode .app-shell {
    grid-template-rows: 78px minmax(0, 1fr) 38px;
}

body.portrait-mode .topbar {
    padding: 7px 12px;
    gap: 8px;
}

body.portrait-mode .logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
}

body.portrait-mode .brand-block {
    gap: 10px;
}

body.portrait-mode .brand-text h1 {
    font-size: 21px;
    line-height: 1.05;
}

body.portrait-mode .subtitle {
    font-size: 12px;
}

body.portrait-mode .screen-meta {
    font-size: 10.5px;
}

body.portrait-mode .clock-box {
    min-width: 112px;
}

body.portrait-mode #clock {
    font-size: 22px;
}

body.portrait-mode #todayDate {
    font-size: 10.5px;
    margin-top: 4px;
}

/* Ruang sebenar selepas header + ticker:
   7fr = slide, 3fr = info bawah */
body.portrait-mode .main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 7fr) minmax(0, 3fr);
    gap: 6px;
    padding: 6px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

body.portrait-mode .slides-wrapper {
    border-radius: 12px;
}

/* Jika poster 9:16, cover akan penuhkan screen.
   Kalau nak nampak keseluruhan tanpa crop, tukar cover kepada contain. */
body.portrait-mode .slide-item img,
body.portrait-mode .slide-item video {
    object-fit: cover;
}

/* Info bawah */
body.portrait-mode .side-panel {
    grid-template-rows: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 6px;
}

body.portrait-mode .panel-card {
    border-radius: 12px;
}

body.portrait-mode .panel-title {
    padding: 6px 10px;
    font-size: 13px;
}

body.portrait-mode .panel-content {
    padding: 4px 0;
    overflow-y: auto;
}

body.portrait-mode .notice-row,
body.portrait-mode .meeting-row {
    padding: 5px 9px;
}

body.portrait-mode .notice-title,
body.portrait-mode .meeting-title {
    font-size: 11.5px;
    line-height: 1.2;
    margin-bottom: 3px;
}

body.portrait-mode .notice-content,
body.portrait-mode .meeting-meta,
body.portrait-mode .meeting-submeta {
    font-size: 10px;
    line-height: 1.2;
}

body.portrait-mode .meeting-time {
    font-size: 9.5px;
    padding: 2px 6px;
    margin-bottom: 3px;
}

body.portrait-mode .active-meeting {
    margin: 4px 6px;
    border-radius: 10px;
    border-left-width: 4px;
}

body.portrait-mode .now-label-inline {
    font-size: 8.5px;
    padding: 2px 6px;
    margin-bottom: 4px;
}

body.portrait-mode .no-display-message {
    font-size: 18px;
}

body.portrait-mode .no-display-message::before {
    font-size: 28px;
}

/* Ticker portrait */
body.portrait-mode .ticker-bar {
    grid-template-columns: 90px minmax(0, 1fr);
}

body.portrait-mode .ticker-label {
    font-size: 10.5px;
}

body.portrait-mode .ticker-text {
    font-size: 20px !important;
    font-weight: 700;
}

/* FORCE FULLSCREEN PORTRAIT - LETAK PALING BAWAH */

html, body {
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
}

body.portrait-mode .app-shell {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: none !important;
}

/* buang ruang kosong bawah */
body.portrait-mode .main-layout {
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

/* bagi slide ambil ruang penuh ikut grid */
body.portrait-mode .hero-panel {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

body.portrait-mode .slides-wrapper {
    height: 100% !important;
    min-height: 0 !important;
}

body.portrait-mode .slide-item,
body.portrait-mode .slide-item.active {
    width: 100% !important;
    height: 100% !important;
    inset: 0 !important;
}

/* kalau nak gambar/poster penuh sampai bawah */
body.portrait-mode .slide-item img,
body.portrait-mode .slide-item video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}


