/* ============================================
   PLAN MANAGER STYLES
   ============================================ */

/* ---- PLAN CURRENT HEADER ---- */
.plan-current-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.plan-current-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.plan-current-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-primary);
    letter-spacing: 0.3px;
}

/* ---- PLAN LIST ---- */
.plan-list {
    padding: 4px 0;
}

.plan-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
    border-left: 2px solid transparent;
    border-radius: var(--radius-sm);
}

.plan-item:hover {
    background: var(--accent-primary-dim);
}

.plan-item.active {
    background: var(--accent-primary-dim);
    border-left-color: var(--accent-primary);
}

.plan-item-info {
    flex: 1;
    min-width: 0;
}

.plan-item-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}

.plan-item.active .plan-item-name {
    color: var(--accent-primary);
}

.plan-item-counts {
    display: block;
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* ---- PLAN THUMBNAILS ---- */
.plan-header-thumb {
    width: 100px;
    height: 62px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
    background: var(--bg-base);
}

.plan-header-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.plan-item-thumb {
    width: 72px;
    height: 45px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
    background: var(--bg-base);
}

.plan-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.plan-item-thumb-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.3;
}

.plan-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
}

.plan-item:hover .plan-item-actions {
    opacity: 1;
}

.plan-action-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    border-radius: var(--radius-sm);
}

.plan-action-btn:hover {
    background: var(--accent-primary-dim);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.plan-delete-btn:hover {
    background: rgba(192, 57, 43, 0.15);
    border-color: rgba(192, 57, 43, 0.3);
    color: #e74c3c;
}

/* ---- PLAN ACTIONS BAR ---- */
.plan-actions-bar {
    padding: 10px 12px;
    border-top: 1px solid var(--border-medium);
}

.plan-new-btn {
    width: 100%;
    padding: 8px;
    font-size: 12px;
    letter-spacing: 0.3px;
    border-radius: var(--radius-sm);
}

/* ---- SHARE DIALOG ---- */
.share-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: overlayIn var(--duration-fast) var(--ease-out);
}

.share-dialog {
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-lg);
    animation: modalIn var(--duration-normal) var(--ease-out);
}

.share-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-medium);
}

.share-dialog-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.share-dialog-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--duration-fast) var(--ease-out);
}

.share-dialog-close:hover {
    color: var(--text-primary);
}

.share-dialog-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
}

.share-plan-info {
    margin-bottom: 16px;
}

.share-plan-name {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    letter-spacing: 0.3px;
}

.share-plan-stats {
    display: block;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    text-align: center;
    border-radius: var(--radius-sm);
}

.share-action-btn svg {
    flex-shrink: 0;
}

/* ---- SHARE DIALOG SECTIONS ---- */
.share-section {
    border: 1px solid var(--border-subtle);
    margin-bottom: 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
}

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

.share-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.share-section-header.collapsible {
    cursor: pointer;
    user-select: none;
}

.share-section-header.collapsible:hover {
    background: var(--accent-primary-dim);
}

.share-section-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.share-section-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.share-section-chevron.collapsed {
    transform: rotate(-90deg);
}

.share-section-body {
    padding: 12px 14px;
}

.share-section-body.collapsed {
    display: none;
}

/* ---- USER SEARCH ---- */
.share-search-wrap {
    position: relative;
    margin-bottom: 12px;
}

.share-search-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 8px 12px;
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-out);
    border-radius: var(--radius-sm);
}

.share-search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--border-focus);
}

.share-search-input::placeholder {
    color: var(--text-muted);
}

.share-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-top: none;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.share-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.share-search-item:hover {
    background: var(--accent-primary-dim);
}

.share-search-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.share-search-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.share-search-username {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-left: auto;
}

.share-search-empty {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- SHARED USER LIST ---- */
.share-user-list-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

.share-user-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.share-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border: 1px solid transparent;
    transition: all var(--duration-fast) var(--ease-out);
    border-radius: var(--radius-sm);
}

.share-user-item:hover {
    background: var(--accent-primary-dim);
    border-color: var(--border-subtle);
}

.share-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.share-user-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}

.share-user-perm {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 3px 24px 3px 8px;
    cursor: pointer;
    outline: none;
    border-radius: var(--radius-xs);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8678' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: border-color var(--duration-fast) var(--ease-out);
}

.share-user-perm:hover {
    border-color: var(--border-medium);
}

.share-user-perm option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.share-user-remove {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-out);
    border-radius: var(--radius-sm);
}

.share-user-item:hover .share-user-remove {
    opacity: 1;
}

.share-user-remove:hover {
    background: rgba(192, 57, 43, 0.15);
    border-color: rgba(192, 57, 43, 0.3);
    color: #e74c3c;
}

.share-user-empty {
    padding: 16px 0;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ---- READONLY BADGE (non-owner) ---- */
.share-readonly-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    font-size: 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.share-readonly-badge svg {
    color: var(--accent-primary);
    flex-shrink: 0;
}

.share-readonly-perm {
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ---- PLAN LIST SHARED INDICATORS ---- */
.plan-item-shared-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    color: var(--text-muted);
    flex-shrink: 0;
    vertical-align: middle;
}

.plan-item-owner {
    display: block;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.plan-item-perm-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 1px 6px;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    margin-left: 6px;
    border-radius: var(--radius-sm);
}

.plan-item-perm-badge.perm-write {
    color: var(--accent-primary);
    border-color: rgba(212, 175, 55, 0.2);
}

/* ---- TOAST NOTIFICATION ---- */
.share-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated);
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 10px 24px;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.share-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- AFFILIATION BUTTONS (in marker popup) ---- */
.nato-popup-affiliation {
    display: flex;
    gap: 4px;
}

.nato-affil-btn {
    flex: 1;
    background: var(--bg-base);
    border: 1px solid var(--border-medium);
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 4px 2px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-align: center;
    border-radius: var(--radius-sm);
}

.nato-affil-btn:hover {
    background: var(--accent-primary-dim);
    color: var(--text-primary);
}

.nato-affil-btn.active {
    background: rgba(212, 175, 55, 0.15);
    color: var(--text-primary);
    font-weight: 700;
}

/* ---- RANGE SLIDER IN POPUP ---- */
.nato-popup-range {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-medium);
    outline: none;
    margin-top: 4px;
}

.nato-popup-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: 2px solid var(--bg-base);
}

.nato-popup-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: 2px solid var(--bg-base);
}

/* ---- INVITE LINKS ---- */
.share-invite-create {
    margin-bottom: 12px;
}

.share-invite-form {
    display: flex;
    gap: 8px;
}

.share-invite-perm,
.share-invite-uses {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 6px 24px 6px 10px;
    cursor: pointer;
    outline: none;
    border-radius: var(--radius-xs);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a8678' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: border-color var(--duration-fast) var(--ease-out);
}

.share-invite-perm option,
.share-invite-uses option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.share-invite-perm:hover,
.share-invite-uses:hover {
    border-color: var(--border-medium);
}

.share-invite-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    font-size: 11px;
    letter-spacing: 0.3px;
    border-radius: var(--radius-sm);
}

.share-invite-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.share-invite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    transition: all var(--duration-fast) var(--ease-out);
    border-radius: var(--radius-sm);
}

.share-invite-item:hover {
    border-color: var(--border-medium);
    background: var(--accent-primary-dim);
}

.invite-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.invite-token {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.invite-perm-badge {
    font-family: var(--font-sans);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 6px;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

.invite-perm-badge.perm-write {
    color: var(--accent-primary);
    border-color: rgba(212, 175, 55, 0.2);
}

.invite-usage {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-left: auto;
}

.invite-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.invite-copy-btn,
.invite-revoke-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    border-radius: var(--radius-sm);
}

.invite-copy-btn:hover {
    background: var(--accent-primary-dim);
    border-color: var(--border-medium);
    color: var(--accent-primary);
}

.invite-revoke-btn:hover {
    background: rgba(192, 57, 43, 0.15);
    border-color: rgba(192, 57, 43, 0.3);
    color: #e74c3c;
}
