/* ============================================================
   CLUBE DE TÉNIS DAS TAIPAS — Custom styles
   ============================================================ */

/* --- Colour palette ---
   Primary:   #1A5276  (deep blue)
   Accent:    #2ECC71  (green - tennis)
   Dark:      #1C2833
   Light bg:  #F4F6F7
   ============================================================ */

/* --- Logo --- */
#logo {
    width: 155px;
    height: 75px;
    background-image: url("../imgs-client/layout/logo.png");
    background-size: contain;
    background-position: center left;
    background-repeat: no-repeat;
}

/* --- Header --- */
#header {
    background: linear-gradient(135deg, #1C2833 0%, #1A5276 100%);
    border-bottom: 3px solid #2ECC71;
}

#header-i18n-mobile {
    display: none !important;
}

@media screen and (max-width: 768px) {
    #header-i18n-mobile {
        display: flex !important;
    }
}

/* Bandeiras dentro do #topbar original — sempre escondidas quando #header-i18n-mobile existe */
@media screen and (max-width: 768px) {
    #topbar #topbar-i18n {
        display: none !important;
        visibility: hidden !important;
        position: static !important;
    }
}

#label {
    background: transparent !important;
}

#label-client {
    text-indent: 165px;
    color: #AED6F1;
    font-size: 13px;
    margin-top: 10px;
    letter-spacing: 0.5px;
}

#label-service {
    text-indent: 165px;
    color: #FFFFFF;
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 0.3px;
}

/* --- Topbar --- */
#topbar {
    color: #AED6F1;
}

#topbar-i18n {
    margin-top: 4px;
}

#topbar-i18n a img {
    border-radius: 3px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#topbar-i18n a:hover img,
#topbar-i18n a.active img {
    opacity: 1.0;
}

/* --- Navigation bar (login bar) --- */
#nav {
    background: #F4F6F7;
    border-bottom: 1px solid #D5D8DC;
}

/* --- Calendar header --- */
.cc-head {
    background: #1A5276;
    color: #FFFFFF;
}

.cc-head a:link,
.cc-head a:visited {
    color: #AED6F1;
}

/* --- Calendar cells --- */
.cc-free {
    color: #27AE60;
}

a.cc-free:link,
a.cc-free:visited { background-color: #D5F5E3; }
a.cc-free:hover   { background-color: #ABEBC6; }

.cc-past {
    color: #AAB7B8;
}

/* --- Booking colours --- */
a.cc-event:link,
a.cc-event:visited  { background-color: #1A5276; }
a.cc-event:hover    { background-color: #154360; }

a.cc-own:link,
a.cc-own:visited    { background-color: #27AE60; }
a.cc-own:hover      { background-color: #1E8449; }

a.cc-single:link,
a.cc-single:visited { background-color: #808D96; }
a.cc-single:hover   { background-color: #4C5359; }

a.cc-multiple:link,
a.cc-multiple:visited { background-color: #1A5276; }
a.cc-multiple:hover   { background-color: #154360; }

a.cc-conflict:link,
a.cc-conflict:visited { background-color: #922B21; }
a.cc-conflict:hover   { background-color: #7B241C; }

/* --- Range calendar --- */
.cc-range-member a {
    border-color: #1A5276 !important;
    background-color: #1A5276 !important;
}

/* --- Buttons --- */
.default-button {
    background: linear-gradient(135deg, #1A5276, #2471A3);
    border: none;
    border-radius: 4px;
    color: #fff;
    transition: background 0.2s ease;
}

.sb-button-blocked {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
}

.default-button:hover {
    background: linear-gradient(135deg, #154360, #1A5276);
}

/* --- Headings --- */
h2, h3, h4, h5, h6 { color: #1A5276; }

/* --- General Purpose --- */
.my-highlight { color: #27AE60; }

.badge         { background-color: #1A5276; }
.badge-label   { color: #1A5276; }

/* --- Links --- */
a:link, a:visited { color: #1A5276; }
a:hover           { color: #2ECC71; }

/* --- Calendar: stronger day column separator --- */
.calendar-date-table,
.calendar-time-table {
    border-left: 3px solid #888 !important;
    border-top: 3px solid #888 !important;
    border-bottom: 3px solid #888 !important;
}

.calendar-table td:last-child .calendar-date-table,
.calendar-table td:last-child .calendar-time-table {
    border-right: 3px solid #888 !important;
}

/* --- Calendar: remove border-left from td inside day columns --- */
.calendar-date-table td,
.calendar-time-table td {
    border-left: none !important;
}

/* --- Calendar: remove gap between day columns --- */
.calendar-table .calendar-date-col,
.calendar-table .calendar-time-col {
    padding: 0 !important;
}

/* --- Calendar sticky headers (all screen sizes) --- */

.calendar-date-row td {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #fff;
    box-shadow: 0 2px 0 #BBB;
}

.calendar-square-row td {
    position: sticky;
    top: 42px;
    z-index: 200;
    background: #fff;
    box-shadow: 0 2px 0 #BBB;
}

.calendar-time-table .calendar-date-row td,
.calendar-time-table .calendar-square-row td {
    z-index: 200;
}

/* --- Sponsor Banner --- */
#sponsor-banner {
    position: relative;
    overflow: hidden;
    background: #F4F6F7;
    border: 1px solid #D5D8DC;
    border-top: none;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.sponsor-label {
    position: absolute;
    left: 16px;
    font-size: 11px;
    font-weight: bold;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.sponsor-slide {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.sponsor-slide.active {
    opacity: 1;
}

.sponsor-slide a {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
}

.sponsor-logo img {
    max-height: 40px;
    max-width: 120px;
    object-fit: contain;
    display: block;
}

.sponsor-slogan {
    font-size: 12px;
    color: #666;
    line-height: 1.5;
    max-width: 240px;
    border-left: 2px solid #D5D8DC;
    padding-left: 14px;
}

@media screen and (max-width: 768px) {
    .sponsor-label {
        display: none;
    }
}

/* --- Layout gaps --- */
#content        { padding: 64px; }   /* espaço branco à volta do conteúdo */
.panel,
.centered-panel { margin-bottom: 8px; }  /* espaço entre painéis */

/* --- Footer --- */
#footer {
    border-top: 2px solid #D5D8DC;
    background: #F4F6F7;
    color: #7F8C8D;
    font-size: 12px;
    padding: 12px 0;
}

#footer a:link,
#footer a:visited { color: #1A5276; }

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */

/* Tablet (≤ 1024px) */
@media screen and (max-width: 1024px) {
    #label-client {
        text-indent: 90px;
        font-size: 12px;
        margin-top: 8px;
    }
    #label-service {
        text-indent: 90px;
        font-size: 17px;
    }
    #logo {
        width: 80px;
        background-position: center;
    }

    #topbar > div:not(#topbar-infos) {
        display: none !important;
        margin: 0 !important;
    }

    /* Toolbar: userpanel em cima, datepicker colado ao calendário */
    #calendar-toolbar {
        display: flex;
        flex-direction: column;
        padding: 0;
        gap: 0;
    }

    #calendar-toolbar-userpanel {
        float: none !important;
        display: block !important;
        order: 1;
    }

    #calendar-toolbar-datepicker {
        float: none !important;
        display: block !important;
        text-align: center;
        margin: 0;
        padding: 6px 4px;
        order: 2;
    }
}

/* Header mobile: 3 colunas — bandeiras | logo | infos (≤ 768px) */
@media screen and (max-width: 768px) {

    #header {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        align-items: center;
        padding: 8px 16px;
        min-height: 80px;
        box-sizing: border-box;
    }

    #header-i18n-mobile {
        grid-column: 1;
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
    }

    #header-i18n-mobile #topbar-i18n {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        display: flex !important;
        float: none !important;
        margin: 0 !important;
    }

    #label {
        grid-column: 2;
        display: flex !important;
        justify-content: center;
        align-items: center;
        position: relative !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        z-index: auto !important;
        padding: 0 !important;
        height: 100% !important;
        min-height: 54px;
        background: transparent !important;
        overflow: visible !important;
    }

    #label a#logo {
        display: block;
    }

    #logo {
        width: 155px;
        height: 75px;
        background-position: center;
        background-size: contain;
        display: block;
    }

    #label-client,
    #label-service,
    #branding {
        display: none !important;
    }

    #topbar {
        grid-column: 3;
        position: relative !important;
        margin: 0 !important;
        height: auto !important;
        display: flex !important;
        justify-content: flex-end;
        align-items: center;
        padding: 0 !important;
        width: 100%;
        box-sizing: border-box;
    }

    #topbar #topbar-i18n {
        display: none !important;
        position: static !important;
        visibility: hidden !important;
    }

    #topbar-infos {
        display: flex !important;
        flex-direction: column;
        align-items: flex-end;
        margin: 0 !important;
        padding: 0 !important;
        background: none !important;
        background-image: none !important;
        font-size: 12px;
    }

    #topbar-infos p {
        margin: 0;
        text-align: right;
        line-height: 1.4;
    }

    #topbar-infos .light-gray {
        display: none !important;
    }

    #topbar-infos .large-text {
        font-size: 0 !important;
    }

    #topbar-infos .large-text a {
        font-size: 0 !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        border: 1px solid #AED6F1;
        color: #AED6F1 !important;
    }

    #topbar-infos .large-text a::before {
        content: "i";
        font-size: 11px;
        font-style: italic;
        font-weight: bold;
        color: #AED6F1;
    }

    #topbar-contact,
    #topbar-website,
    #topbar-phone,
    #topbar-separator {
        display: none !important;
    }
}

/* Userpanel (≤ 768px) */
@media screen and (max-width: 768px) {

    html, body {
        min-width: 0 !important;
    }

    #calendar-toolbar {
        display: flex !important;
        flex-direction: column !important;
        padding: 0;
        gap: 0;
    }

    #calendar-toolbar-datepicker {
        float: none !important;
        display: block !important;
        text-align: center;
        margin: 0;
        padding: 6px 4px;
        order: 2;
    }

    #calendar-toolbar-userpanel {
        float: none !important;
        display: block !important;
        order: 1;
        width: 100%;
        box-sizing: border-box;
        padding: 6px 4px;
    }

    #calendar-toolbar-userpanel table {
        display: block !important;
        width: 100%;
    }

    #calendar-toolbar-userpanel tbody {
        display: block !important;
        width: 100%;
    }

    #calendar-toolbar-userpanel tr {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 5px;
        width: 100%;
    }

    #calendar-toolbar-userpanel td {
        display: block !important;
        flex: 0 0 auto;
        padding: 2px !important;
        border: none !important;
    }

    #calendar-toolbar-userpanel td.userpanel-spacer {
        display: none !important;
    }

    #userpanel-status {
        font-size: 11px;
        text-align: center;
        line-height: 1.4;
    }

    #calendar-toolbar-userpanel .default-button,
    #calendar-toolbar-userpanel a.default-button {
        display: block;
        font-size: 11px;
        padding: 7px 10px;
        white-space: nowrap;
        text-align: center;
    }
}

/* Mobile (≤ 512px) */
@media screen and (max-width: 512px) {

    body {
        padding: 0 !important;
    }

    /* Calendar: only 1 day visible — no horizontal scroll needed, sticky works */
    #calendar {
        padding: 0;
        position: relative;
    }

    #calendar .calendar-table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
    }

    /* Hide extra day columns — show only index 0 (no responsive-pass class) */
    .responsive-pass-3,
    .responsive-pass-4 {
        display: none !important;
    }

    /* Sticky time column */
    .calendar-time-col {
        position: sticky;
        left: 0;
        z-index: 20;
        width: 80px !important;
        min-width: 80px;
        background: #fff;
    }

    .calendar-date-row td {
        height: 48px;
        padding: 2px !important;
        vertical-align: middle;
        overflow: hidden;
        top: 0;
    }

    .calendar-square-row td {
        height: 30px;
        padding: 2px !important;
        vertical-align: middle;
        overflow: hidden;
        top: 48px;
    }

    .calendar-core-row td {
        height: 48px;
        padding: 2px !important;
        vertical-align: middle;
        overflow: hidden;
    }

    .calendar-time-table td {
        background: #fff;
    }

    .calendar-cell {
        font-size: 13px;
        padding: 3px 2px !important;
        white-space: normal !important;
        line-height: 1.3;
        display: block;
        box-sizing: border-box;
        overflow: hidden !important;
        height: 100%;
    }

    .cc-label {
        height: auto !important;
        white-space: normal !important;
        overflow: visible !important;
        line-height: 1.3;
    }

    .cts-label, .day-label { font-size: 13px; }
    .cte-label             { font-size: 11px; }
    .square-label          { font-size: 12px; }

    #content {
        padding: 0 !important;
    }

    .panel, .centered-panel {
        border-radius: 0;
        box-shadow: none;
        padding: 8px;
    }
}

@media screen and (max-width: 768px) {
    /* Squarebox booking form: stack columns vertically on mobile */
    #squarebox-overlay + div.panel,
    body > div.panel {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-y: auto;
        border-radius: 0;
        box-sizing: border-box;
        padding: 12px;
    }

    body > div.panel .middle-table,
    body > div.panel .middle-table tbody,
    body > div.panel .middle-table tr {
        display: block;
        width: 100%;
    }

    body > div.panel .middle-table > tbody > tr > td {
        display: block;
        width: 100%;
        border: none;
        padding: 4px 0;
    }

    body > div.panel .sandbox {
        margin-bottom: 8px;
    }
}
