/**
 * TGC Portal — Frontend Styles
 *
 * Matches the Divi theme and ARForms styling used on the existing site.
 * Accent color: rgba(3,91,100,0.77) / #035b64
 */

/* Hide Divi sidebar on all TGC portal pages */
.page-template-default:has(.tgc-form-wrap) #sidebar,
.page-template-default:has(.tgc-dashboard-wrap) #sidebar {
    display: none;
}

.page-template-default:has(.tgc-form-wrap) #left-area,
.page-template-default:has(.tgc-dashboard-wrap) #left-area {
    width: 100%;
    border: none;
    padding-right: 0;
}

.page-template-default:has(.tgc-form-wrap) .container::before,
.page-template-default:has(.tgc-dashboard-wrap) .container::before {
    display: none;
}

/* Form wrapper */
.tgc-form-wrap {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

.tgc-form-wrap h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #035b64;
    font-family: inherit;
}

.tgc-form-intro {
    color: #666;
    margin-bottom: 28px;
    font-size: 14px;
}

/* Fields */
.tgc-form .tgc-field {
    margin-bottom: 20px;
}

.tgc-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 400;
    font-size: 14px;
    color: #666;
}

.tgc-form label .required {
    color: #035b64;
}

.tgc-form input[type="text"],
.tgc-form input[type="email"],
.tgc-form input[type="tel"],
.tgc-form input[type="password"],
.tgc-form input[type="url"],
.tgc-form input[type="number"],
.tgc-form input[type="date"],
.tgc-form input[type="time"],
.tgc-form select,
.tgc-form textarea {
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid #ddd;
    border-radius: 0;
    font-size: 16px;
    font-family: inherit;
    background: transparent;
    color: #333;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.tgc-form input:focus,
.tgc-form select:focus,
.tgc-form textarea:focus {
    border-bottom-color: #035b64;
    outline: none;
    box-shadow: none;
}

.tgc-form textarea {
    resize: vertical;
    min-height: 80px;
    border: 1px solid #ddd;
    padding: 12px;
    border-radius: 3px;
}

.tgc-form textarea:focus {
    border-color: #035b64;
}

.tgc-form select {
    padding-right: 30px;
    cursor: pointer;
}

.tgc-field-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: #999;
}

/* Buttons */
.tgc-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s, opacity 0.2s;
    line-height: 1.4;
}

.tgc-btn-primary {
    background: rgba(3, 91, 100, 0.77);
    color: #fff;
}

.tgc-btn-primary:hover {
    background: #035b64;
    color: #fff;
}

.tgc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tgc-submit {
    margin-top: 28px;
}

/* Notices */
.tgc-notice {
    padding: 14px 18px;
    border-radius: 3px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

/* TGC-93: save notice rendered beside/below the Save button (Manage
   Collection). Sits at the end of the form, so drop the trailing margin and
   add a little top gap to separate it from the button. */
.tgc-inline-result {
    margin-top: 12px;
    margin-bottom: 0;
}

.tgc-notice-error {
    background: #fef0f0;
    border-left: 4px solid #d63638;
    color: #721c24;
}

.tgc-notice-success {
    background: #f0fdf0;
    border-left: 4px solid #035b64;
    color: #155724;
}

.tgc-notice-info {
    background: #e8f4fd;
    border-left: 4px solid #035b64;
    color: #084298;
}

/* Inline fields (checkboxes) */
.tgc-field-inline label {
    font-weight: 400;
}

.tgc-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.tgc-checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Footer */
.tgc-form-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #666;
}

.tgc-form-footer a {
    color: #035b64;
    text-decoration: none;
}

.tgc-form-footer a:hover {
    text-decoration: underline;
}

/* Loading spinner */
.tgc-btn.tgc-loading {
    position: relative;
    color: transparent;
}

.tgc-btn.tgc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tgc-spin 0.6s linear infinite;
}

@keyframes tgc-spin {
    to { transform: rotate(360deg); }
}

/* Secondary button */
.tgc-btn-secondary {
    background: #e2e3e5;
    color: #383d41;
}

.tgc-btn-secondary:hover {
    background: #c3c4c7;
    color: #383d41;
}

/* Link-style button */
.tgc-btn-link {
    background: none;
    border: none;
    color: #035b64;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
    text-decoration: none;
}

.tgc-btn-link:hover {
    text-decoration: underline;
}

/* Tabs */
.tgc-tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 28px;
}

.tgc-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    text-align: center;
    transition: color 0.2s, border-color 0.2s;
}

.tgc-tab:hover {
    color: #035b64;
}

.tgc-tab-active {
    color: #035b64;
    border-bottom-color: #035b64;
}

/* TGC-69: locked tab — donor booking Tab 2 is greyed out until "Proceed to Booking" is clicked. */
.tgc-tab[disabled],
.tgc-tab-locked {
    color: #b5b5b5;
    cursor: not-allowed;
    opacity: 0.7;
}
.tgc-tab[disabled]:hover,
.tgc-tab-locked:hover {
    color: #b5b5b5;
}

/* TGC-69: donor-booking Tab 1 info content — restore paragraph spacing.
   Divi resets default <p> margins on form pages, so wpautop-generated
   paragraphs from the admin's rich-text content render flush by default. */
.tgc-donor-info-content p {
    margin: 0 0 1em;
    line-height: 1.55;
}
.tgc-donor-info-content p:last-child {
    margin-bottom: 0;
}
.tgc-donor-info-content ul,
.tgc-donor-info-content ol {
    margin: 0 0 1em 1.5em;
    line-height: 1.55;
}

.tgc-tab-panel {
    display: none;
}

.tgc-tab-panel-active {
    display: block;
}

/* Tab navigation buttons */
.tgc-tab-nav {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 28px;
}

/* TGC-60 — nested Family Member tabs (smaller, lighter than top-level tabs). */
.tgc-family-tabs-bar {
    flex-wrap: wrap;
    border-bottom-width: 1px;
    margin-top: 16px;
    margin-bottom: 16px;
}
.tgc-family-tabs-bar:empty {
    display: none;
}
.tgc-family-tabs-bar .tgc-family-tab {
    flex: 0 1 auto;
    padding: 8px 14px;
    font-size: 13px;
}
.tgc-family-panels:empty {
    display: none;
}
.tgc-family-member-placeholder {
    padding: 16px;
    background: #f6f6f6;
    border: 1px dashed #ccc;
    border-radius: 4px;
    color: #555;
}
.tgc-family-member-placeholder h3 {
    margin-top: 0;
    color: #035b64;
}

/* Request form — wider for 2-tab layout */
.tgc-request-form-wrap {
    max-width: 700px;
}

/* Item rows */
.tgc-item-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.tgc-item-fields {
    display: flex;
    gap: 12px;
    flex: 1;
}

.tgc-item-desc {
    flex: 3;
}

.tgc-item-qty {
    flex: 1;
    max-width: 80px;
}

.tgc-item-qty input[type="number"] {
    text-align: center;
}

.tgc-remove-item {
    background: none;
    border: none;
    color: #d63638;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    margin-bottom: 20px;
}

.tgc-remove-item:hover {
    color: #a00;
}

/* Booking form */
.tgc-booking-form-wrap {
    max-width: 600px;
}

/* Time slot radio buttons */
.tgc-slot-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.tgc-slot-option {
    display: block;
    cursor: pointer;
}

.tgc-slot-option input[type="radio"] {
    display: none;
}

.tgc-slot-option span {
    display: inline-block;
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    transition: border-color 0.2s, background 0.2s;
}

.tgc-slot-option input[type="radio"]:checked + span {
    border-color: #035b64;
    background: rgba(3, 91, 100, 0.08);
    color: #035b64;
}

.tgc-slot-option span:hover {
    border-color: #035b64;
}

/* Fieldsets (donor booking form) */
.tgc-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 28px;
}

.tgc-fieldset legend {
    font-size: 16px;
    font-weight: 600;
    color: #035b64;
    margin-bottom: 16px;
    padding: 0;
}

/* Danger button */
.tgc-btn-danger {
    background: #d63638;
    color: #fff;
}

.tgc-btn-danger:hover {
    background: #a00;
    color: #fff;
}

/* Manage collection actions */
.tgc-manage-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

/* Cancel confirmation box */
.tgc-confirm-box {
    background: #fef0f0;
    border: 1px solid #d63638;
    border-radius: 3px;
    padding: 20px;
    margin-bottom: 24px;
}

.tgc-confirm-box p {
    margin: 0 0 16px;
    font-weight: 600;
    color: #721c24;
}

.tgc-confirm-buttons {
    display: flex;
    gap: 12px;
}

/* Reschedule section */
#tgc-reschedule-wrap {
    border-top: 1px solid #ddd;
    padding-top: 24px;
    margin-bottom: 24px;
}

#tgc-reschedule-wrap h3 {
    font-size: 18px;
    font-weight: 600;
    color: #035b64;
    margin-bottom: 20px;
}

/* Booking summary table */
.tgc-booking-summary {
    margin-bottom: 24px;
}

.tgc-summary-table {
    width: 100%;
    border-collapse: collapse;
}

.tgc-summary-table th,
.tgc-summary-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.tgc-summary-table th {
    width: 140px;
    color: #666;
    font-weight: 400;
}

.tgc-summary-table td {
    color: #333;
}

/* Status badges. TGC-70: !important to win specificity battles with Divi
   (which resets background/color on inline elements inside form / card
   layouts). Each status gets its own rule so a CSS minifier can't drop
   one of a comma-grouped selector pair. */
.tgc-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tgc-status-tgc-pending {
    background: #fff3cd !important;
    color: #856404 !important;
}

.tgc-status-tgc-confirmed {
    background: #cce5ff !important;
    color: #004085 !important;
}

.tgc-status-tgc-collected {
    background: #d1ecf1 !important;
    color: #0c5460 !important;
}

.tgc-status-tgc-delivered {
    background: #d1ecf1 !important;
    color: #0c5460 !important;
}

.tgc-status-tgc-cancelled {
    background: #f8d7da !important;
    color: #721c24 !important;
}

/* Reschedule booking section */
#tgc-reschedule-booking-wrap {
    border-top: 1px solid #ddd;
    padding-top: 24px;
    margin-bottom: 24px;
}

#tgc-reschedule-booking-wrap h3 {
    font-size: 18px;
    font-weight: 600;
    color: #035b64;
    margin-bottom: 20px;
}

/* Request list cards (unbooked requests) */
.tgc-request-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tgc-request-card:hover {
    border-color: #035b64;
    box-shadow: 0 1px 4px rgba(3, 91, 100, 0.12);
}

.tgc-request-card strong {
    font-size: 15px;
    color: #035b64;
}

.tgc-request-meta {
    color: #666;
    font-size: 13px;
    flex: 1;
    margin: 0;
}

.tgc-request-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.tgc-request-action {
    color: #035b64;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.tgc-request-action-secondary {
    font-weight: 400;
    color: #666;
}

.tgc-request-action-secondary:hover {
    color: #035b64;
}

.tgc-dashboard-wrap .tgc-request-actions button.tgc-request-action-danger {
    color: #b32d2e;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: inherit;
}

.tgc-dashboard-wrap .tgc-request-actions button.tgc-request-action-danger:hover {
    color: #8b1a1b;
}

/* Dashboard */
.tgc-dashboard-wrap {
    max-width: 800px;
}

.tgc-dashboard-actions {
    margin-bottom: 32px;
    text-align: right;
}

.tgc-dashboard-section {
    margin-bottom: 36px;
}

.tgc-dashboard-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #035b64;
    margin-bottom: 16px;
}

/* Card layout: ID left | meta center | status+actions right */
.tgc-request-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tgc-request-card-main {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    gap: 12px;
}

.tgc-request-card-main > strong {
    flex-shrink: 0;
}

.tgc-request-card-main .tgc-request-meta {
    flex: 1;
    min-width: 0;
}

.tgc-request-card-main .tgc-status {
    flex-shrink: 0;
    margin-left: auto;
}

/* Actions group sits to the far right of the card */
.tgc-request-card > .tgc-request-actions {
    flex-shrink: 0;
    margin-left: auto;
}

/* Compact item rows inside booking and request forms */
.tgc-booking-form-wrap .tgc-item-row,
.tgc-request-form-wrap .tgc-item-row {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: none;
    align-items: center;
}

.tgc-booking-form-wrap .tgc-item-fields,
.tgc-request-form-wrap .tgc-item-fields {
    gap: 8px;
}

/* Only show labels on the first row */
.tgc-booking-form-wrap .tgc-item-row:first-child .tgc-field label,
.tgc-request-form-wrap .tgc-item-row:first-child .tgc-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.tgc-booking-form-wrap .tgc-item-row:not(:first-child) .tgc-field label,
.tgc-request-form-wrap .tgc-item-row:not(:first-child) .tgc-field label {
    display: none;
}

.tgc-booking-form-wrap .tgc-item-row .tgc-field,
.tgc-request-form-wrap .tgc-item-row .tgc-field {
    margin-bottom: 0;
}

.tgc-booking-form-wrap .tgc-remove-item {
    margin-bottom: 0 !important;
    padding: 4px 6px !important;
    font-size: 16px !important;
}

@media (max-width: 600px) {
    .tgc-request-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .tgc-request-card-main {
        flex-wrap: wrap;
        width: 100%;
    }

    .tgc-request-meta {
        margin: 0;
        width: 100%;
    }

    .tgc-request-card > .tgc-request-actions {
        margin-left: 0;
        width: 100%;
    }
}
