/* ============================================
   Share Calendar Modal
   ============================================ */

.share-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1070;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.share-modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.share-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 95%;
    max-width: 560px;
    max-height: 80vh;
    background: var(--color-card-bg);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1071;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.share-modal.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
}

.share-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.share-modal-close:hover {
    color: #fff;
}

.share-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.share-section {
    margin-bottom: 0.25rem;
}

.share-token-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.share-token-url {
    word-break: break-all;
    font-size: 0.78rem;
}

@media (max-width: 576px) {
    .share-modal {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
}

/* =============================================================================
   Availability Settings (Sprint 7.4)
   ============================================================================= */

.avail-day-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--color-border);
}

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

.avail-day-label {
    width: 100px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
}

.avail-day-rules {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
    min-height: 2rem;
}

.avail-rule-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: var(--calendar-avail-bg);
    border: 1px solid color-mix(in srgb, var(--color-success) 20%, transparent);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--color-text);
}

.avail-rule-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 0.875rem;
}

.avail-rule-remove:hover {
    background: var(--color-error);
    color: #fff;
}

.avail-no-rules {
    font-style: italic;
    color: var(--color-text-light);
    font-size: 0.8125rem;
}

.avail-day-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}

.avail-day-add:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.avail-overnight-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-warning);
    background: color-mix(in srgb, var(--color-warning) 12%, transparent);
    padding: 0 0.25rem;
    border-radius: 2px;
}

.avail-disabled-banner {
    padding: 0.75rem 1rem;
    background: color-mix(in srgb, var(--color-warning) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-warning) 25%, transparent);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--color-text);
}

/* Responsive: mobile stacking */
@media (max-width: 767.98px) {
    .avail-day-row {
        flex-wrap: wrap;
    }

    .avail-day-label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

/* =============================================================================
   Calendar Connection Cards (Collapsible)
   ============================================================================= */

/* --- Google account card --- */

.cal-account {
    border: 1px solid #e5e7eb;
    border-left: 3px solid #4285f4;
    border-radius: 8px;
    background: #fff;
    transition: box-shadow 0.15s;
}

.cal-account + .cal-account {
    margin-top: 0.5rem;
}

.cal-account:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.cal-account__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cal-account__toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    flex: 1;
    min-width: 0;
}

.cal-account__icon {
    color: #4285f4;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.cal-account__email {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-account__count {
    font-size: 0.65rem;
    flex-shrink: 0;
}

.cal-account__chevron {
    font-size: 0.75rem;
    color: #9ca3af;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.cal-account__chevron.is-open {
    transform: rotate(180deg);
}

.cal-account__actions {
    display: flex;
    gap: 0.25rem;
    padding-right: 0.5rem;
    flex-shrink: 0;
}

/* Expanded panel */
.cal-account__panel {
    border-top: 1px solid #f3f4f6;
    padding: 0.25rem 0.75rem 0.5rem;
}

/* Individual calendar toggle row */
.cal-account__calendar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0;
}

.cal-account__calendar + .cal-account__calendar {
    border-top: 1px solid #f3f4f6;
}

.cal-account__cal-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.cal-account__cal-name {
    font-size: 0.85rem;
}

.cal-account__cal-status {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.cal-account__empty {
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    color: #9ca3af;
}

.cal-account__error {
    padding: 0.125rem 0;
    font-size: 0.8125rem;
}

/* --- Section toggle (iCal heading) --- */

.cal-section__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-family: inherit;
}

.cal-section__toggle:hover .cal-section__title {
    color: var(--brand-primary, #4f46e5);
}

.cal-section__label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cal-section__icon {
    color: #6c757d;
    font-size: 0.9rem;
}

.cal-section__title {
    font-weight: 600;
    font-size: 0.85rem;
    transition: color 0.15s;
}

.cal-section__count {
    font-size: 0.65rem;
}

.cal-section__chevron {
    font-size: 0.75rem;
    color: #9ca3af;
    transition: transform 0.2s;
}

.cal-section__chevron.is-open {
    transform: rotate(180deg);
}
