/* ═══════════════════════════════════════════════════════════════
   SGM Zoom Calendar — Front-End Styles
   ═══════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────────────────── */
:root {
    --sgm-font-primary: 'Manrope', sans-serif;
    --sgm-font-heading: 'Barlow Semi Condensed', sans-serif;
    --sgm-teal: #00B2B2;
    --sgm-light-teal: #00E5E5;
    --sgm-blue: #063B84;
    --sgm-orange: #F86328;
    --sgm-navy: #001739;
    --sgm-dark-navy: #010A17;
    --sgm-black: #000B1A;
    --sgm-light-grey: #F4F4F4;
    --sgm-white: #ffffff;
    --sgm-border: #e2e5ea;
    --sgm-text-muted: #7a8290;
    --sgm-radius: 8px;
    --sgm-radius-sm: 5px;
    --sgm-tab-bg: #1e2a3a;
    --sgm-tab-bg-hover: #2a3a4e;
    --sgm-tab-active-bg: #0d1f33;
}

/* ─── Calendar Wrapper ───────────────────────────────────────── */
.sgm-calendar-wrap {
    max-width: 1640px;
    width: 90vw;
    margin: 0 auto;
    padding: 0 16px;
    font-family: var(--sgm-font-primary);
}

/* ─── Tabs ───────────────────────────────────────────────────── */
.sgm-calendar-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    justify-content: center;
}

.sgm-tab {
    /* border: 1px solid var(--sgm-tab-bg); */
    border-radius: 50px;
    background: var(--sgm-tab-bg)!important;
    color: rgba(255, 255, 255, 1);
    opacity:0.65;
    font-family: var(--sgm-font-heading);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sgm-tab:focus,
.sgm-tab:hover {
    background: var(--sgm-tab-bg-hover)!important;
    border-color: var(--sgm-tab-bg-hover)!important;
    color: var(--sgm-white)!important;
    opacity:1;
}

.sgm-tab--active {
    background: var(--sgm-tab-active-bg)!important;
    color: var(--sgm-white)!important;
    opacity:1;
}

.sgm-tab--active:hover {
    background: var(--sgm-tab-active-bg)!important;
    color: var(--sgm-white)!important;
}

/* ─── Intro Text ─────────────────────────────────────────────── */
.sgm-calendar-intro {
    text-align: center;
    font-size: 1.5rem;
    color: var(--sgm-black);
    font-family: var(--sgm-font-primary);
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ─── Link Retrieval Panel ───────────────────────────────────── */
.sgm-retrieve-intro {
    text-align: center;
    /* font-size: 0.95rem; */
    /* color: var(--sgm-text-muted); */
    font-family: var(--sgm-font-primary);
    margin: 0 0 10px;
    margin-bottom:1.5rem;
    line-height: 1.5;
}

.sgm-retrieve-intro a {
    color: var(--sgm-teal);
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.15s ease;
}

.sgm-retrieve-intro a:hover {
    color: var(--sgm-light-teal);
}

.sgm-retrieve-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    margin-bottom: 0;
    transition: max-height 0.35s ease, margin-bottom 0.35s ease;
}

.sgm-retrieve-panel--open {
    max-height: 800px;
    margin-bottom: 20px;
}

.sgm-retrieve-panel__inner {
    background: #fff;
    border: 1px solid var(--sgm-border);
    border-radius: var(--sgm-radius);
    padding: 24px;
    text-align: center;
}

.sgm-retrieve-panel__heading {
    font-family: var(--sgm-font-heading);
    /* font-size: 20px; */
    font-weight: 600;
    color: var(--sgm-navy);
    margin: 0 0 8px;
}

.sgm-retrieve-panel__subtext {
    font-size: 1rem;
    /* color: var(--sgm-text-muted); */
    margin: 0 0 16px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.sgm-retrieve-panel__form {
    display: flex;
    gap: 10px;
    max-width: 460px;
    margin: 0 auto;
}

.sgm-retrieve-panel__input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--sgm-border);
    border-radius: var(--sgm-radius-sm);
    font-family: var(--sgm-font-primary);
    font-size: 14px;
    color: var(--sgm-navy);
    background: var(--sgm-white);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    line-height:1.25;
}

.sgm-retrieve-panel__input:focus {
    border-color: var(--sgm-teal);
    box-shadow: 0 0 0 2px rgba(0, 178, 178, 0.2);
}

.sgm-retrieve-panel__btn {
    padding: 10px 20px;
    background: var(--sgm-teal);
    color: var(--sgm-white);
    border: none;
    border-radius: var(--sgm-radius-sm);
    font-family: var(--sgm-font-heading);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.sgm-retrieve-panel__btn:hover {
    background: var(--sgm-light-teal);
}

.sgm-retrieve-panel__btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sgm-retrieve-panel__result {
    margin-top: 16px;
    font-family: var(--sgm-font-primary);
    font-size: 15px;
    line-height: 1.5;
}

.sgm-retrieve-panel__result--success {
    color: var(--sgm-navy);
}

.sgm-retrieve-panel__result--success p {
    margin: 0 0 12px;
}

.sgm-retrieve-panel__result--success .wp-block-buttons{
    justify-content:center;
}

.sgm-retrieve-panel__result--error {
    color: #c0392b;
}

.sgm-retrieve-panel__result--error a {
    color: #c0392b;
    text-decoration: underline;
    font-weight: 600;
}

@media (max-width: 520px) {
    .sgm-retrieve-panel__form {
        flex-direction: column;
    }

    .sgm-retrieve-panel__btn {
        width: 100%;
    }
}

/* ─── Calendar Grid ──────────────────────────────────────────── */
.sgm-calendar-grid {
    width: 100%;
    border: 1px solid var(--sgm-border);
    border-radius: var(--sgm-radius);
    overflow: hidden;
    --sgm-cols: repeat(5, minmax(0, 1fr)) minmax(0, 0.55fr) minmax(0, 0.55fr);
}

.sgm-grid-header {
    display: grid;
    grid-template-columns: var(--sgm-cols);
}

.sgm-grid-header-cell {
    padding: 14px 8px;
    text-align: center;
    font-family: var(--sgm-font-heading);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--sgm-navy);
    background: var(--sgm-light-grey);
    border-bottom: 1px solid var(--sgm-border);
    border-right: 1px solid var(--sgm-border);
}

.sgm-grid-header-cell:last-child {
    border-right: none;
}

.sgm-grid-body {
    display: grid;
    grid-template-columns: var(--sgm-cols);
}

/* ─── Day Cells ──────────────────────────────────────────────── */
.sgm-day {
    background: var(--sgm-white);
    min-height: 150px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-bottom: 1px solid var(--sgm-border);
    border-right: 1px solid var(--sgm-border);
}

.sgm-day:nth-child(7n) {
    border-right: none;
}

.sgm-day--last-row {
    border-bottom: none;
}

.sgm-day--empty {
    background: #fafafa;
}

.sgm-day--past {
    opacity: 0.45;
    pointer-events: none;
}

.sgm-day--today {
    background: #f0fafa;
}

.sgm-day__number {
    font-size: 15px;
    font-weight: 700;
    color: var(--sgm-navy);
    margin-bottom: 6px;
    line-height: 1;
}

.sgm-day--today .sgm-day__number {
    color: var(--sgm-teal);
}

/* ─── Meeting Cards ──────────────────────────────────────────── */
.sgm-meeting-card {
    background: var(--sgm-light-grey);
    border-left: 3px solid var(--sgm-teal);
    border-radius: var(--sgm-radius-sm);
    padding: 7px 10px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 3px;
    position: relative;
}

.sgm-meeting-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sgm-meeting-card__arrow {
    position: absolute;
    top: 7px;
    right: 7px;
    color: var(--sgm-text-muted);
    opacity: 0.5;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.sgm-meeting-card:hover .sgm-meeting-card__arrow {
    opacity: 1;
    color: var(--sgm-teal);
}

.sgm-meeting-card__header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sgm-meeting-card__avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sgm-white);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--sgm-font-primary);
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.sgm-meeting-card__host {
    font-size: 11px;
    color: var(--sgm-text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sgm-meeting-card__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--sgm-navy);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sgm-meeting-card__time {
    font-size: 11px;
    color: var(--sgm-teal);
    font-weight: 600;
}

/* ─── Modal Overlay ──────────────────────────────────────────── */
.sgm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 11, 26, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sgm-modal-overlay--open {
    opacity: 1;
    visibility: visible;
}

/* ─── Modal Dialog ───────────────────────────────────────────── */
.sgm-modal {
    background: var(--sgm-white);
    border-radius: 14px;
    width:1200px;
    max-width:90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.04);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s ease;
}

.sgm-modal-overlay--open .sgm-modal {
    transform: translateY(0) scale(1);
}

.sgm-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: none!important;
    border: none;
    cursor: pointer;
    color: #8f9fba;
    padding: 6px!important;
    border-radius: 0;
    transition: color 0.15s ease;
    z-index: 2;
    line-height: 0;
}

.sgm-modal-close:hover {
    color: var(--sgm-white);
    background: none!important;
}

.sgm-modal-close:focus {
    outline: none;
    color: var(--sgm-white);
    background: none!important;
}

.sgm-modal-close svg{
    width:32px;
    height:32px;
}

/* ─── Modal Body ─────────────────────────────────────────────── */
.sgm-modal-body {
    padding: 0;
}

/* ─── Two-Panel Layout ───────────────────────────────────────── */
.sgm-modal__layout {
    display: flex;
    min-height: 480px;
}

.sgm-modal__info {
    flex: 1 1 30%;
    padding: 36px;
    overflow-y: auto;
}

.sgm-modal__form-panel {
    flex: 1 1 70%;
    background: var(--sgm-navy);
    padding: 36px;
    border-radius: 0 14px 14px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sgm-modal__form-panel .gform_validation_errors{
    display:none!important;
}

.sgm-modal__form-panel .gform_confirmation_message{
    color:#fff;
    font-size:1.5rem;
    opacity:0.85;
}

.sgm-modal__form-heading {
    font-family: var(--sgm-font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--sgm-white);
    margin: 0 0 24px;
    line-height: 1.2;
}

/* ─── Meeting Info (Left Panel) ──────────────────────────────── */
.sgm-modal__avatar-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.sgm-modal__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sgm-white);
    font-size: 19px;
    font-weight: 700;
    font-family: var(--sgm-font-primary);
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

.sgm-modal__host-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--sgm-navy);
    font-family: var(--sgm-font-primary);
}

.sgm-modal__host-label {
    font-size: 12px;
    color: var(--sgm-text-muted);
    font-family: var(--sgm-font-primary);
    margin-top: 1px;
}

.sgm-modal__title {
    font-family: var(--sgm-font-heading);
    font-size: 26px;
    font-weight: 600;
    color: var(--sgm-navy);
    margin: 0 0 16px;
    line-height: 1.2;
}

.sgm-modal__meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 24px;
}

.sgm-modal__meta-item {
    font-size: 15px;
    color: var(--sgm-text-muted);
    font-family: var(--sgm-font-primary);
}

.sgm-modal__meta-item strong {
    color: var(--sgm-navy);
}

.sgm-modal__description {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    max-height: 290px;
    overflow-y: auto;
}

/* Custom scrollbar for description */
.sgm-modal__description::-webkit-scrollbar {
    width: 6px;
}

.sgm-modal__description::-webkit-scrollbar-track {
    background: transparent;
}

.sgm-modal__description::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sgm-modal__description::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Firefox scrollbar */
.sgm-modal__description {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.sgm-modal__description-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--sgm-teal);
    margin: 0 0 8px;
    font-family: var(--sgm-font-primary);
}

.sgm-modal__description-text {
    font-size: 14px;
    color: var(--sgm-navy);
    line-height: 1.6;
    margin: 0;
    font-family: var(--sgm-font-primary);
}

/* ─── Gravity Form in Dark Panel ─────────────────────────────── */
.sgm-modal__form-panel .gform_wrapper {
    margin: 0 !important;
}

.sgm-modal__form-panel .gform_wrapper .gform_heading {
    display: none;
}

.sgm-modal__form-panel .gform_wrapper label,
.sgm-modal__form-panel .gform_wrapper .gfield_label {
    color: rgba(255, 255, 255, 0.85) !important;
}

.sgm-modal__form-panel .gform_wrapper .gfield_description {
    color: rgba(255, 255, 255, 0.75) !important;
}

.sgm-modal__form-panel .gform_wrapper .gfield_description.gfield_validation_message {
    color: #ff895b!important;
    font-weight:bold;
}

.sgm-modal__form-panel .gform_wrapper input[type="text"],
.sgm-modal__form-panel .gform_wrapper input[type="email"],
.sgm-modal__form-panel .gform_wrapper input[type="tel"],
.sgm-modal__form-panel .gform_wrapper input[type="number"],
.sgm-modal__form-panel .gform_wrapper textarea,
.sgm-modal__form-panel .gform_wrapper select {
    background: rgba(255, 255, 255, 1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: var(--sgm-navy) !important;
    border-radius: var(--sgm-radius-sm) !important;
}

.sgm-modal__form-panel .gform_wrapper .gchoice{
    display:flex;
    align-items:center;
}

.sgm-modal__form-panel .gform_wrapper input.gfield-choice-input{
    padding:0!important;
    height:2rem!important;
    min-height:2rem!important;
    width:2rem!important;
    aspect-ratio:1/1!important;
}

.sgm-modal__form-panel .gform_wrapper .gchoice label{
    font-weight:bold!important;
    font-size:1rem;
}

.sgm-modal__form-panel .gform_wrapper select{
    line-height: 1.5 !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
    
    /* Custom down arrow */
    background-image: url('/wp-content/uploads/arrow-icon-down.svg') !important;
    background-repeat: no-repeat!important;
    background-position: right 1rem center!important;
    background-size: 1.5rem !important;
}

.sgm-modal__form-panel .gform_wrapper select option.gf_placeholder {
    color: var(--sgm-text-muted) !important;
}

.sgm-modal__form-panel .gform_wrapper input::placeholder,
.sgm-modal__form-panel .gform_wrapper textarea::placeholder {
    color: rgba(0, 0, 0, 0.8) !important;
}

.sgm-modal__form-panel .gform_wrapper input[type="text"]:focus,
.sgm-modal__form-panel .gform_wrapper input[type="email"]:focus,
.sgm-modal__form-panel .gform_wrapper input[type="tel"]:focus,
.sgm-modal__form-panel .gform_wrapper input[type="number"]:focus,
.sgm-modal__form-panel .gform_wrapper textarea:focus,
.sgm-modal__form-panel .gform_wrapper select:focus {
    border-color: var(--sgm-teal) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 178, 178, 0.25) !important;
}

.sgm-modal__form-panel .gform_wrapper .gform_button,
.sgm-modal__form-panel .gform_wrapper input[type="submit"] {
    background: var(--sgm-teal) !important;
    color: var(--sgm-white) !important;
    border: none !important;
    border-radius: var(--sgm-radius) !important;
    font-family: var(--sgm-font-heading) !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    padding: 12px 28px !important;
    cursor: pointer !important;
    transition: background 0.2s ease !important;
    width: 100% !important;
}

.sgm-modal__form-panel .gform_wrapper .gform_button:hover,
.sgm-modal__form-panel .gform_wrapper input[type="submit"]:hover {
    background: var(--sgm-light-teal) !important;
}

.sgm-modal__form-panel .gform_fields,
.sgm-modal__form-panel .ginput_complex{
    gap:.75rem!important;
}

.sgm-modal__form-panel .iti__tel-input{
    padding-left:1rem!important;
}

.sgm-modal__form-panel .iti__country-container,
.sgm-modal__form-panel #field_2_4{
    display:none!important;
}

.sgm-modal__form-panel textarea#input_2_3{
    max-height:60px!important;
}

/* Force field_2_14 to start on a new row, half width matching other fields */
.sgm-modal__form-panel #field_2_14{
    grid-column: 1!important;
    grid-column-end: span 6!important;
}

/* Hidden by default — JS shows when modal opens */
#sgm-gf-form-wrap {
    display: none;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1081px) {
    .sgm-modal__avatar-row{
        flex-direction:column;
        align-items:flex-start;
    }

    .sgm-modal__form-panel select,
    .sgm-modal__form-panel input,
    .sgm-modal__form-panel textarea{
        font-size:.875rem!important;
    }
}

@media (max-width: 960px) {
    .sgm-calendar-wrap {
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
    }

    /* Switch to list view */
    .sgm-grid-header {
        display: none;
    }

    .sgm-calendar-grid {
        border: none;
        border-radius: var(--sgm-radius);
    }

    .sgm-grid-body {
        display: flex;
        flex-direction: column;
        gap: 0;
        border: 1px solid var(--sgm-border);
        border-radius: var(--sgm-radius);
    }

    .sgm-day {
        min-height: auto;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--sgm-border);
    }

    .sgm-day--last-row {
        border-bottom: 1px solid var(--sgm-border);
    }

    .sgm-day:last-child {
        border-bottom: none;
    }

    .sgm-day--empty,
    .sgm-day--no-meetings,
    .sgm-day--past {
        display: none;
    }

    .sgm-day__number {
        font-size: 15px;
        margin-bottom: 8px;
    }

    /* Show full date on mobile */
    .sgm-day__number::after {
        content: attr(data-full-date);
        font-weight: 400;
        color: var(--sgm-text-muted);
        margin-left: 6px;
        font-size: 13px;
    }

    .sgm-meeting-card {
        padding: 10px 12px;
    }

    .sgm-meeting-card__title {
        font-size: 14px;
    }

    .sgm-meeting-card__avatar {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    /* Modal */
    .sgm-modal-overlay {
        padding: 12px;
        align-items: flex-end;
        align-items:flex-start;
    }

    .sgm-modal {
        max-height:calc(100vh - 24px);
        max-height:calc(100svh - 24px);
        min-height:calc(100vh - 24px);
        min-height:calc(100svh - 24px);
        height:calc(100vh - 24px);
        height:calc(100svh - 24px);
        /* top:7.5vh; */
        max-width: 100%;
        border-radius: 14px;
    }

    .sgm-modal__layout {
        flex-direction: column;
        min-height: auto;
    }

    .sgm-modal__info {
        padding: 24px 20px;
        padding-right:60px;
    }

    .sgm-modal__form-panel {
        border-radius: 0;
        padding: 24px 20px;
    }

    .sgm-modal__title {
        font-size: 22px;
    }

    .sgm-modal__avatar {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .sgm-modal-close {
        color: var(--sgm-text-muted);
    }

    .sgm-modal-close:hover,
    .sgm-modal-close:focus {
        color: var(--sgm-navy);
    }

    .sgm-modal__description{
        max-height:auto!important;
    }
}

@media (max-width:639px) {
    .sgm-modal__form-panel #field_2_14{
        grid-column-end: span 12 !important;
    }
}

@media (max-width: 480px) {
    .sgm-calendar-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .sgm-tab {
        text-align: center;
    }
}

/* ─── Scroll Lock ────────────────────────────────────────────── */
body.sgm-modal-open {
    overflow: hidden;
}