/* ── Calendar Page ─────────────────────────────────────────── */

.cal-page {
    --navy: #0a2540;
    --navy-mid: #14365a;
    --ocean: #1a6fb5;
    --ocean-light: #e8f2fa;
    --ocean-pale: #f0f7fc;
    --accent: #0ea5e9;
    --accent-glow: rgba(14, 165, 233, 0.15);
    --sand: #f8f6f2;
    --text: #1e3556;
    --text-muted: #5a7a9b;
    --white: #ffffff;
    --border: rgba(26, 111, 181, 0.12);
    --shadow-sm: 0 1px 3px rgba(10, 37, 64, 0.06);
    --shadow-md: 0 4px 16px rgba(10, 37, 64, 0.08);
    --shadow-lg: 0 8px 32px rgba(10, 37, 64, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

    padding-top: 70px;
    background: var(--sand);
    min-height: 100vh;
}

/* ── Breadcrumb ───────────────────────────────────────────── */

.cal-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    font-size: 13px;
    color: var(--text-muted);
}

.cal-breadcrumb a {
    color: var(--ocean);
    text-decoration: none;
    transition: color var(--transition);
}

.cal-breadcrumb a:hover {
    color: var(--navy);
}

.cal-breadcrumb svg {
    opacity: 0.4;
    flex-shrink: 0;
}

.cal-breadcrumb span {
    color: var(--text);
    font-weight: 500;
}

/* ── Hero ─────────────────────────────────────────────────── */

.cal-hero {
    position: relative;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, var(--ocean) 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 48px 40px 60px;
    margin-bottom: 0;
    overflow: hidden;
}

.cal-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 300px at 80% 20%, rgba(14, 165, 233, 0.2), transparent),
        radial-gradient(ellipse 400px 200px at 20% 80%, rgba(255, 255, 255, 0.05), transparent);
    pointer-events: none;
}

.cal-hero__content {
    position: relative;
    z-index: 1;
}

.cal-hero__title {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 700;
    color: var(--white);
    margin: 0 0 8px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.cal-hero__subtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
    font-weight: 400;
    max-width: 520px;
    line-height: 1.5;
}

.cal-hero__wave {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    color: var(--sand);
    line-height: 0;
}

.cal-hero__wave svg {
    width: 100%;
    height: 24px;
}

/* ── Anchor navigation ─────────────────────────────────────── */

.cal-nav {
    display: flex;
    gap: 6px;
    padding: 16px 24px;
    background: var(--white);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.cal-nav::-webkit-scrollbar {
    display: none;
}

.cal-nav a {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ocean);
    text-decoration: none;
    background: var(--ocean-pale);
    border-radius: 20px;
    white-space: nowrap;
    transition: all var(--transition);
}

.cal-nav a:hover {
    background: var(--ocean);
    color: var(--white);
}

/* ── Content area ─────────────────────────────────────────── */

.cal-content {
    background: var(--white);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 28px;
    margin-bottom: 40px;
}

/* ── Sections (replace tabs — all content visible for SEO) ── */

.cal-section {
    margin-bottom: 32px;
    scroll-margin-top: 80px;
}

.cal-section:last-child {
    margin-bottom: 0;
}

.cal-section__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--ocean-pale);
}

/* ── Company cards grid ───────────────────────────────────── */

.cal-companies {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.cal-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.cal-card:hover {
    border-color: rgba(14, 165, 233, 0.3);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-glow);
    transform: translateY(-1px);
}

.cal-card__logo {
    flex-shrink: 0;
    width: 110px;
    height: 70px;
    border-radius: 8px;
    background: var(--white);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    transition: border-color var(--transition);
}

.cal-card:hover .cal-card__logo {
    border-color: rgba(14, 165, 233, 0.25);
}

.cal-card__logo img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.cal-card__fallback {
    font-size: 11px;
    font-weight: 600;
    color: var(--navy);
    text-align: center;
    line-height: 1.3;
}

.cal-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cal-card__name {
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 4px;
    line-height: 1.3;
}

.cal-card__desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.45;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0 0 10px;
}

.cal-card__actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cal-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ocean);
    background: var(--ocean-pale);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.cal-btn:hover {
    background: var(--ocean);
    color: var(--white);
}

.cal-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── Calendar result area ─────────────────────────────────── */

.cal-result {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* ── Loading indicator ────────────────────────────────────── */

.cal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px;
    color: var(--text-muted);
    font-size: 14px;
}

.cal-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--ocean);
    border-radius: 50%;
    animation: calSpin 0.7s linear infinite;
}

@keyframes calSpin {
    to { transform: rotate(360deg); }
}

/* ── Calendar table (AJAX loaded) ─────────────────────────── */

.list_calendar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

.list_calendar table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.list_calendar table td.first {
    background: var(--navy);
    color: var(--white);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 10px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.list_calendar table td.first:first-child {
    text-align: left;
    min-width: 160px;
}

.list_calendar table td.first small {
    display: block;
    font-size: 10px;
    font-weight: 400;
    opacity: 0.6;
    letter-spacing: 1px;
    margin-top: 2px;
}

.list_calendar table tr.tr_second td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
    transition: background var(--transition);
}

.list_calendar table tr.tr_second td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--navy);
    background: var(--ocean-pale);
    border-right: 2px solid var(--border);
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 160px;
}

.list_calendar table tr.tr_second:hover td {
    background: rgba(14, 165, 233, 0.04);
}

.list_calendar table tr.tr_second:hover td:first-child {
    background: rgba(14, 165, 233, 0.08);
}

.list_calendar table tr.tr_second td:last-child {
    border-right: none;
}

.list_calendar table tr:last-child td {
    border-bottom: none;
}

.list_calendar table tr.tr_second td p {
    margin: 0;
    padding: 0;
}

.list_calendar table tr.tr_second td a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ocean);
    background: var(--ocean-pale);
    border-radius: 6px;
    text-decoration: none;
    transition: all var(--transition);
}

.list_calendar table tr.tr_second td a:hover {
    background: var(--ocean);
    color: var(--white);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.list_calendar table tr.tr_second td a.trLink {
    display: inline;
    min-width: auto;
    height: auto;
    padding: 0;
    background: none;
    border-radius: 0;
    color: var(--navy);
    font-weight: 500;
    font-size: 13px;
}

.list_calendar table tr.tr_second td a.trLink:hover {
    color: var(--ocean);
    background: none;
    transform: none;
    box-shadow: none;
    text-decoration: underline;
}

/* ── Company header in AJAX result ────────────────────────── */

.list_calendar h1 {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: var(--navy) !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 12px !important;
}

/* ── No data state ────────────────────────────────────────── */

.list_calendar p:only-child,
.cal-result p:only-child {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
    .cal-hero {
        padding: 32px 20px 48px;
    }

    .cal-tabs {
        padding: 12px 16px 0;
    }

    .cal-tabs a {
        padding: 8px 14px;
        font-size: 13px;
    }

    .cal-panel {
        padding: 16px;
    }

    .cal-companies {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cal-card {
        padding: 12px;
    }

    .cal-card__logo {
        width: 80px;
        height: 56px;
        padding: 8px;
    }

    .list_calendar table td.first,
    .list_calendar table tr.tr_second td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .list_calendar table tr.tr_second td:first-child {
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .cal-companies {
        grid-template-columns: 1fr;
    }

    .cal-card {
        padding: 14px;
    }

    .cal-card__logo {
        width: 80px;
        height: 52px;
        padding: 8px;
    }

    .cal-card__actions {
        gap: 8px;
    }

    .cal-btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ── Detail page layout ───────────────────────────────────── */

.cal-detail {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 32px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 32px;
    margin-bottom: 40px;
}

.cal-detail__sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cal-detail__logo {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

.cal-detail__logo img {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
}

.cal-detail__stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cal-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--ocean-pale);
    border-radius: 6px;
}

.cal-stat__num {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
    min-width: 36px;
}

.cal-stat__label {
    font-size: 13px;
    color: var(--text-muted);
}

.cal-btn--full {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
}

.cal-btn--outline {
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.cal-btn--outline:hover {
    background: var(--ocean-pale);
    color: var(--ocean);
    border-color: var(--ocean);
}

.cal-detail__main {
    min-width: 0;
}

.cal-detail__main h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--ocean-pale);
}

.cal-card__name a {
    color: inherit;
    text-decoration: none;
}

.cal-card__name a:hover {
    color: var(--ocean);
}

.cal-card__logo {
    text-decoration: none;
}

@media (max-width: 768px) {
    .cal-detail {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 20px;
    }

    .cal-detail__sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }

    .cal-detail__logo {
        width: 100px;
        min-height: auto;
    }

    .cal-detail__stats {
        flex: 1;
        flex-direction: row;
    }

    .cal-stat {
        flex: 1;
    }
}

/* ── Override parent page styles ──────────────────────────── */

.cal-page .page-content {
    background: none;
    border: none;
    padding: 0;
}

.cal-page h1 {
    border: none;
    padding: 0;
    margin: 0;
}