/* =========================
   Layout / Sticky footer
   ========================= */
html,
/* =========================
   Design tokens
   ========================= */
:root {
    --accent: #ff5722;
    --line: #e9edf3;
    --good: #2e7d32;
    --warn: #ff8f00;
    --ink: #1f2937;
    --muted: #667085;
    --head-bg: #fff3e9;
    --head-bdr: #ffd8c7;
    --row-bdr: #eaeaea;
    --row-hover: #fff9f5;
    --row-alt: #fafafa;
    --curr-bdr: #ffb893;
    --curr-bar: #ff8a50;
    --header-orange: #ff5722;
    --header-orange-dark: #d84315;
    --header-orange-hover: #e64a19;
}

body {
    -webkit-font-smoothing: auto;
    -moz-osx-font-smoothing: auto;
    text-rendering: optimizeLegibility;
}

/* When the main grid is reversed, make it stack on small screens */
@media (max-width:600px) {
    .w3-row-reverse {
        display: flex;
        flex-direction: column-reverse;
    }
}

/* =========================
   TOPBAR
   ========================= */
.topbar.three-cols {
    display: grid;
    grid-template-columns: auto minmax(280px, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    background: #fff;
}

.tb-left,
.tb-center,
.tb-right {
    min-width: 0;
}

.school-logo {
    display: block;

    max-height: 140px;
    width: auto;
    height: auto;

    object-fit: contain;
}

.search-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
}

.search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 15px;
}

.search-btn {
    padding: 8px 14px;
    background: var(--accent);
    border: none;
    color: #fff;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
}

.search-btn:hover {
    filter: brightness(.95);
}

.tb-right {
    text-align: left;
    font-size: 12px;
    line-height: 1.35;
    color: #666;
}

.tb-right a {
    color: #0645AD;
}

@media (max-width:900px) {

    .topbar.three-cols {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 14px 12px;
    }

    .tb-left {
        width: 100%;
        text-align: center;
    }

    .tb-left a {
        display: block;
        width: 100%;
    }

    .school-logo {
        display: block;

        width: 100%;
        max-width: 100%;

        height: auto;
        max-height: none;

        object-fit: contain;
    }
}

/* =========================
   Navigation (single source of truth)
   ========================= */

/* Desktop bar typography */
.w3-bar.w3-deep-orange.w3-card.w3-medium {
    font-size: 15px;
}

/* Default: desktop visible, mobile hidden */
.nav-desktop {
    display: block;
}

.mnav-wrap {
    display: none;
    padding: 6px;
}

/* Switch on small screens */
@media (max-width:900px) {
    .nav-desktop {
        display: none !important;
    }

    .mnav-wrap {
        display: block !important;
    }
}

/* Mobile nav look */
.mnav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mnav-list>li {
    margin-bottom: 6px;
}

.mnav-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    background: var(--header-orange);
    color: #fff;
    border: 1px solid var(--header-orange-dark);
    font-weight: 500;
    text-decoration: none;
}

.mnav-item:hover {
    background: var(--header-orange-hover);
    color: #fff;
}

.has-children .mnav-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.caret {
    transition: transform .2s ease;
}

.mnav-sub {
    background: #ff7043;
    border-left: 4px solid #cc4520;
    margin-top: 4px;
}

.mnav-sub-item {
    display: block;
    padding: 10px 16px;
    color: #fff;
    border-bottom: 1px solid #d95c34;
    text-decoration: none;
}

.mnav-sub-item:hover {
    background: #f4511e;
}

/* =========================
   HOMEPAGE SLIDESHOW
   ========================= */
.home-ss-wrap {
    position: relative;
    width: 100%;
    background: #000;
    border: 1px solid #009688;
    border-radius: 4px;
    overflow: hidden;
}

.home-ss-slide {
    display: none;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: #000;
}

.home-ss-slide.active {
    display: block;
}

.home-ss-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    font-size: 14px;
    padding: 6px 10px;
}

/* Remove black bg / aspect lock on mobile */
.home-ss-wrap,
.home-ss-slide {
    background: transparent !important;
}

.home-ss-wrap img.home-ss-slide {
    display: block;
}

@media (max-width:900px) {
    .home-ss-wrap {
        aspect-ratio: auto !important;
    }
}

/* =========================
   Content spacing helpers
   ========================= */
.responsive-margin-right {
    margin-left: 0;
    margin-right: 0;
    padding-left: 16px;
    padding-right: 16px;
}

@media (max-width:900px) {
    .responsive-margin-right {
        padding-left: 12px;
        padding-right: 12px;
    }

    .w3-quarter {
        padding-left: 12px;
        padding-right: 12px;
        box-sizing: border-box;
    }
}

/* =========================
   Panels / Lists
   ========================= */
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.panel h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.list-item {
    padding: 8px 6px;
    border-bottom: 1px solid var(--line);
}

.list-item:last-child {
    border-bottom: none;
}

.plan-list {
    background: #fafafa;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
}

.plan-item {
    padding: 8px;
    border-bottom: 1px solid var(--line);
}

.plan-item:last-child {
    border-bottom: none;
}

.plan-time {
    color: #5b6470;
    font-size: 13px;
}

/* =========================
   Timetable styles - FINAL STABLE
   ========================= */
.timetable {
    margin-bottom: 18px;
}

.tt {
    background: #fff;
    border: 1px solid var(--header-orange-dark);
    border-radius: 6px;
    overflow: hidden;
}

/* GRID */
.tt .head,
.tt .r {
    display: grid;
    grid-template-columns: 21% 12% 12% 15% 40%;
    column-gap: 10px;
    align-items: center;
}

/* HEADER */
.tt .head {
    padding: 11px 10px;
    background: var(--header-orange) !important;
    color: #fff !important;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.1;
}

.tt .head>div {
    white-space: nowrap;
    overflow: visible;
}

/* ROWS */
.tt .r {
    padding: 10px 10px;
    font-size: clamp(10px, 0.62vw, 11.5px);
    background: #fff;
    border: 0 !important;
    border-bottom: 1px solid #f3d2c5 !important;
}

.tt .r:last-child {
    border-bottom: 0 !important;
}

.tt .r>div {
    min-width: 0;
    white-space: nowrap;
}

/* last column */
.tt .r>div:last-child {
    min-width: 0;
    padding-right: 12px;
    box-sizing: border-box;
}

/* STATUS / REMAIN */
.tt .status {
    white-space: nowrap;
}

.tt .remain {
    display: block;
    width: 100%;
    font-weight: 800;
    font-size: clamp(9.5px, 0.55vw, 10.5px);
    color: #334155;
    white-space: nowrap;
    overflow: visible;
    padding-right: 12px;
    box-sizing: border-box;
}

/* STRIPES */
#ttBody .r:nth-child(even) {
    background: #fffaf7;
}

#ttBody .r:hover {
    background: #fff1e8;
}

/* CURRENT LESSON */
.row-current-lesson {
    background: linear-gradient(135deg, #ffb199 0%, #ff8a65 100%) !important;
    border-top: 2px solid var(--header-orange) !important;
    border-bottom: 2px solid var(--header-orange) !important;
    box-shadow: 0 4px 14px rgba(255, 87, 34, .25);
    position: relative;
    z-index: 1;
}

.row-current-lesson>div {
    font-weight: 950 !important;
    color: #000 !important;
}

.row-current-lesson .status,
.row-current-lesson .remain {
    font-weight: 950 !important;
    color: #000 !important;
}

/* PAST */
.row-past {
    opacity: .55;
}

/* BADGES */
.badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 900;
    font-size: clamp(9px, 0.52vw, 10px);
    display: inline-flex;
    align-items: center;
    line-height: 1.1;
    white-space: nowrap;
}

.badge-green {
    background: #2e7d32;
    color: #fff;
    border: 1px solid #1b5e20;
}

.badge-amber {
    background: #ff8f00;
    color: #fff;
    border: 1px solid #ef6c00;
}

/* MEDIUM WIDTH */
@media (max-width: 1200px) {

    .tt .head,
    .tt .r {
        grid-template-columns: 20% 11% 11% 14% 44%;
        column-gap: 7px;
    }

    .tt .head {
        padding: 10px 7px;
        font-size: 9px;
    }

    .tt .r {
        padding: 9px 7px;
        font-size: 10px;
    }

    .tt .remain {
        font-size: 9.2px;
        padding-right: 14px;
    }

    .badge {
        padding: 3px 6px;
        font-size: 9px;
    }
}

/* NARROW RIGHT COLUMN */
@media (max-width: 980px) {

    .tt .head,
    .tt .r {
        grid-template-columns: 19% 11% 11% 13% 46%;
        column-gap: 5px;
    }

    .tt .head {
        font-size: 8.5px;
    }

    .tt .r {
        font-size: 9.5px;
    }

    .tt .remain {
        font-size: 8.8px;
        padding-right: 16px;
    }
}

/* MOBILE */
@media (max-width: 700px) {
    .tt .head {
        display: none;
    }

    .tt .r {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 12px;
        font-size: 13px;
    }

    .tt .r>div {
        white-space: normal;
    }

    .tt .r>div:first-child {
        font-size: 15px;
    }

    .tt .r>div:nth-child(2)::before {
        content: "Sākums: ";
        font-weight: 700;
        color: #667085;
    }

    .tt .r>div:nth-child(3)::before {
        content: "Beigas: ";
        font-weight: 700;
        color: #667085;
    }

    .tt .r>div:nth-child(4)::before {
        content: "Statuss: ";
        font-weight: 700;
        color: #667085;
    }

    .tt .r>div:nth-child(5)::before {
        content: "Atlikušais laiks: ";
        font-weight: 700;
        color: #667085;
    }

    .tt .remain {
        font-size: 13px;
        padding-right: 0;
        white-space: normal;
    }
}

/* =========================
   Right column cards
   ========================= */
.side-card {
    margin-top: 16px;
    margin-bottom: 16px;
    background: #fff;
    border: 1px solid var(--header-orange-dark);
    border-radius: 6px;
    overflow: hidden;
}

.side-card-head {
    background: var(--header-orange) !important;
    color: #fff;
    padding: 10px 12px;
}

.side-card-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
}

.side-card-head-with-action {
    position: relative;
    padding-right: 46px;
}

.side-card-head-with-action a {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #fff !important;
    color: #d84315 !important;
    border: 1px solid #fff !important;
    text-decoration: none;
}

.side-card-body {
    background: #fff;
    padding: 8px 10px;
}

.side-card-body-tight {
    padding: 8px;
}

.side-row {
    padding: 9px 4px;
    border-bottom: 1px solid #f3d2c5;
}

.side-row:last-child {
    border-bottom: 0;
}

.side-row strong {
    color: #1f2937;
    font-weight: 850;
}

.side-row-note {
    margin-top: 3px;
    font-size: 12px;
    color: #667085;
}

.side-empty {
    padding: 10px 4px;
    color: #667085;
    font-size: 14px;
}

/* =========================
   “Skolēniem” list buttons
   ========================= */
.students-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.students-list a {
    display: block;
    padding: 10px 14px;
    margin: 2px 0;
    border: 1px solid var(--accent);
    color: var(--accent) !important;
    font-weight: 600;
    border-radius: 0;
    text-decoration: none;
    background: #fff;
    transition: background-color .2s ease, color .2s ease;
}

.students-list a:hover,
.students-list a:focus {
    background: #f1f1f1;
    color: #000 !important;
}

/* =========================
   Custom table for logos
   ========================= */
.custom-table {
    width: 100%;
}

.custom-table td {
    padding: 8px;
}

.custom-table img {
    object-fit: fill;
    width: 100%;
    height: 100%;
}

/* =========================
   Notifications
   ========================= */
.notif-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notif-title {
    flex: 1 1 auto;
    min-width: 0;
}

.notif-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-ghost {
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #333;
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
}

.btn-ghost:hover {
    background: #f1f1f1;
}

.btn-link {
    border: 1px solid var(--accent);
    background: #fff;
    color: var(--accent);
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 3px;
    text-decoration: none;
}

.btn-link:hover {
    background: #f1f1f1;
    color: #000;
}

.notif-body {
    display: none;
    position: relative;
    padding: 10px 12px;
    background: #fff;
}

.notif-body.open {
    display: block;
}

.header-overlay {
    position: relative;
}

.header-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .08), rgba(0, 0, 0, .08));
    pointer-events: none;
}

/* Make header text white on colored headers */
.w3-container[class*="w3-"] .notif-title h3,
.w3-container[class*="w3-"] .notif-title div,
.custom-colored-header .notif-title h3,
.custom-colored-header .notif-title div {
    color: #fff !important;
}

.custom-colored-header {
    color: #fff;
}

.notif-panel {
    padding-bottom: 14px;
}

.notif-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.notif-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.notif-btn:hover,
.notif-btn:focus {
    color: #000 !important;
}

.pub-label {
    font-size: 11px;
    color: #555;
    margin-left: auto;
}

@media (max-width:640px) {
    .notif-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .notif-bar .notif-btn,
    .notif-bar a.notif-btn {
        width: auto;
        text-align: left;
    }

    .pub-label {
        margin-left: 0;
        align-self: flex-start;
    }
}

.w3-pale-red .pub-label,
.w3-pale-yellow .pub-label,
.w3-pale-green .pub-label,
.w3-white .pub-label,
.custom-colored-header[style*="background: #fff"] .pub-label,
.custom-colored-header[style*="background: white"] .pub-label {
    color: #555;
}

/* Footer line at the very bottom of the panel */
.notif-pub {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line, #e9edf3);
    font-size: 11px;
    color: #555;
}

.notif-footer {

    padding-bottom: 0px;

    font-size: 11px;
    color: #555;
    text-align: right;
    /* or left if you prefer */
}



/* simple card grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 1100px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
}

.news-card {
    border: 1px solid teal;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.news-thumb {
    aspect-ratio: 16/9;
    width: 100%;
    object-fit: cover;
    background: #f6f6f6;
    display: block;
}

/* no-image icon style */
.news-thumb--noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #9aa3af;
    font-size: 48px;
}

.news-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.news-title {
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.news-meta {
    font-size: 12px;
    color: #5f6b7a;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.news-card a:hover .news-title {
    text-decoration: underline;
}

.news-pager {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 16px;
}

.news-pager a,
.news-pager span {
    border: 1px solid #e0e0e0;
    padding: 6px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    background: #fff;
}

.news-pager .active {
    border-color: #ff5722;
    color: #ff5722;
    font-weight: 700;
}

.news-pager a:hover {
    background: #f1f1f1;
}