/* ================================================
   SETTINGS VIEW - MINIMAL CLEAN STRUCTURE
   ================================================ */

/* ================================================
   TAB NAVIGATION
   ================================================ */

/* Tab Navigation Container */
.tasknotes-plugin .settings-view__tab-nav {
    display: flex;
    gap: var(--tn-spacing-xs);
    margin-bottom: var(--tn-spacing-lg);
    border-bottom: 1px solid var(--tn-border-color);
    padding-bottom: var(--tn-spacing-sm);
    overflow-x: auto;
    white-space: nowrap;
}

/* Use consistent button system */
.tasknotes-plugin .settings-view__tab-button {
    white-space: nowrap;
    flex-shrink: 0;
}

.tasknotes-plugin .settings-view__tab-button--active {
    background: var(--tn-interactive-accent);
    color: var(--text-on-accent);
}

/* ================================================
   TAB CONTENT
   ================================================ */

/* Tab Contents Container */
.tasknotes-plugin .settings-view__tab-contents {
    position: relative;
    min-height: 400px;
}

/* Tab Content Panel */
.tasknotes-plugin .settings-view__tab-content {
    display: none;
}

.tasknotes-plugin .settings-view__tab-content--active {
    display: block;
    animation: tn-settings-fade-in 0.2s ease-in-out;
}

@keyframes tn-settings-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================================================
   TASKNOTES SETTINGS CARD SYSTEM - CLEAN MINIMAL BASE
   ================================================ */

/* Base Card */
.tasknotes-settings__card {
    background: var(--background-primary);
    border: 1px solid var(--background-modifier-border);
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
}

.tasknotes-settings__card:hover {
    border-color: var(--interactive-accent);
}

/* Card Header */
.tasknotes-settings__card-header {
    padding: 12px 16px;
    background: var(--background-secondary);
    border-bottom: 1px solid var(--background-modifier-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.tasknotes-settings__card-header--with-drag-handle {
    padding-left: 40px;
}

.tasknotes-settings__card-info {
    flex: 1;
    min-width: 0;
}

.tasknotes-settings__card-primary-text {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-normal);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tasknotes-settings__card-secondary-text {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
    display: block;
    margin-top: 2px;
}

.tasknotes-settings__card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tasknotes-settings__card-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid var(--background-primary);
    box-shadow: 0 0 0 1px var(--background-modifier-border);
}

/* Card Content */
.tasknotes-settings__card-content {
    padding: 16px;
}

.tasknotes-settings__card-config-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.tasknotes-settings__card-config-row:last-child {
    margin-bottom: 0;
}

.tasknotes-settings__card-config-label {
    min-width: 80px;
    font-weight: 500;
    color: var(--text-normal);
    font-size: 13px;
    margin-right: 12px;
}

/* Card Inputs */
.tasknotes-settings__card-input {
    padding: 8px 12px;
    border: 1px solid var(--background-modifier-border);
    border-radius: 4px;
    background: var(--background-modifier-form-field);
    color: var(--text-normal);
    font-size: 13px;
    line-height: 1.4;
    min-height: 32px;
}

/* Select dropdowns need extra styling */
.tasknotes-settings__card-input[type="select"],
select.tasknotes-settings__card-input {
    padding: 6px 12px;
    line-height: 1.5;
    min-height: 34px;
}

.tasknotes-settings__card-input[type="text"],
.tasknotes-settings__card-input[type="url"],
.tasknotes-settings__card-input[type="email"] {
    flex: 1;
}

.tasknotes-settings__card-input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    align-self: center !important;
}

.tasknotes-settings__card-input[type="color"] {
    width: 40px;
    height: 32px;
    padding: 2px;
}

.tasknotes-settings__card-input[type="number"] {
    width: 80px;
}

.tasknotes-settings__card-input:focus {
    outline: none;
    border-color: var(--interactive-accent);
}

/* Card Actions */
.tasknotes-settings__card-actions {
    padding: 12px 16px;
    background: var(--background-modifier-form-field);
    border-top: 1px solid var(--background-modifier-border);
    display: flex;
    gap: 8px;
}

.tasknotes-settings__card-action-btn {
    padding: 8px 16px;
    border: 1px solid var(--background-modifier-border);
    border-radius: 4px;
    background: var(--background-primary);
    color: var(--text-normal);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tasknotes-settings__card-action-btn:hover {
    background: var(--background-modifier-hover);
}

.tasknotes-settings__card-action-btn--primary {
    background: none;
    color: var(--text-on-accent);
    border-color: var(--interactive-accent);
}

.tasknotes-settings__card-action-btn--primary:hover {
    background: var(--interactive-accent-hover);
}

.tasknotes-settings__card-action-btn--delete {
    background: var(--color-red);
    color: white;
    border-color: var(--color-red);
}

/* Header Actions */
.tasknotes-settings__card-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tasknotes-settings__card-header-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tasknotes-settings__card-header-btn:hover {
    background: var(--background-modifier-hover);
    color: var(--text-normal);
}

.tasknotes-settings__card-header-btn--delete:hover {
    background: var(--color-red);
    color: white;
}

/* Status Badges */
.tasknotes-settings__card-status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--background-modifier-border);
    color: var(--text-muted);
}

.tasknotes-settings__card-status-badge--active {
    background: var(--color-green);
    color: white;
}

.tasknotes-settings__card-status-badge--inactive {
    background: var(--color-red);
    color: white;
}

.tasknotes-settings__card-info-badge {
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    background: var(--background-modifier-border);
    color: var(--text-muted);
    white-space: nowrap;
}

/* Drag Handle */
.tasknotes-settings__card-drag-handle {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 16px;
    cursor: grab;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.tasknotes-settings__card-drag-handle:hover {
    opacity: 1;
    background: var(--background-modifier-hover);
}

.tasknotes-settings__card-drag-handle:active {
    cursor: grabbing;
}

/* Drag States */
.tasknotes-settings__card--draggable {
    cursor: grab;
}

.tasknotes-settings__card--dragging {
    opacity: 0.7;
    transform: rotate(1deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--interactive-accent);
}

.tasknotes-settings__card--drag-over-top {
    border-top: 2px solid var(--interactive-accent);
}

.tasknotes-settings__card--drag-over-bottom {
    border-bottom: 2px solid var(--interactive-accent);
}

/* Empty state for card containers */
.tasknotes-plugin .settings-view .tasknotes-settings__empty-state {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    background: var(--background-modifier-form-field);
    border: 1px dashed var(--background-modifier-border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.tasknotes-plugin .settings-view .tasknotes-settings__empty-icon {
    display: flex;
    align-items: center;
    opacity: 0.6;
}

.tasknotes-plugin .settings-view .tasknotes-settings__empty-text {
    flex: 1;
}

/* ================================================
   COLLAPSIBLE CARD FUNCTIONALITY
   ================================================ */

/* Collapsible card support */
.tasknotes-settings__card--collapsible {
    transition: all 0.2s ease;
}

.tasknotes-settings__card--collapsible .tasknotes-settings__card-content,
.tasknotes-settings__card--collapsible .tasknotes-settings__card-actions {
    transition: all 0.2s ease;
    overflow: hidden;
}

/* Collapsed state - hide content and actions */
.tasknotes-settings__card--collapsed .tasknotes-settings__card-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border: none;
}

.tasknotes-settings__card--collapsed .tasknotes-settings__card-actions {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    border: none;
}

/* Collapse button styling */
.tasknotes-settings__card-collapse-btn {
    opacity: 0.7;
    transition: all 0.2s ease;
}

.tasknotes-settings__card-collapse-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Visual indicator for collapsed cards */
.tasknotes-settings__card--collapsed {
    opacity: 0.9;
}

/* Clickable header styling */
.tasknotes-settings__card-header--clickable {
    cursor: pointer;
    user-select: none;
}

.tasknotes-settings__card-header--clickable:hover {
    background: var(--background-modifier-hover);
}

/* ================================================
   WEBHOOK MODAL STYLES
   ================================================ */

.tasknotes-webhook-modal {
    max-width: 800px;
    padding: var(--tn-spacing-lg);
}

.tasknotes-webhook-modal-header {
    display: flex;
    align-items: center;
    gap: var(--tn-spacing-md);
    margin-bottom: var(--tn-spacing-lg);
    padding-bottom: var(--tn-spacing-md);
    border-bottom: 1px solid var(--background-modifier-border);
}

.tasknotes-webhook-modal-icon {
    color: var(--interactive-accent);
    font-size: 1.5rem;
}

.tasknotes-webhook-modal-title {
    margin: 0;
    color: var(--text-normal);
    font-size: 1.25rem;
    font-weight: 600;
}

.tasknotes-webhook-modal-section {
    margin-bottom: var(--tn-spacing-xl);
}

.tasknotes-webhook-modal-subsection-header {
    display: flex;
    align-items: center;
    gap: var(--tn-spacing-sm);
    margin-bottom: var(--tn-spacing-md);
}

.tasknotes-webhook-modal-subsection-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-normal);
}

.tasknotes-webhook-events-list .setting-item {
    padding: var(--tn-spacing-sm) 0;
    border-bottom: 1px solid var(--background-modifier-border);
}

.tasknotes-webhook-events-list .setting-item:last-child {
    border-bottom: none;
}

.tasknotes-webhook-transform-help {
    margin-top: var(--tn-spacing-md);
    padding: var(--tn-spacing-md);
    background: var(--background-secondary);
    border-radius: var(--tn-radius-sm);
    border-left: 3px solid var(--interactive-accent);
}

.tasknotes-webhook-help-header {
    display: flex;
    align-items: center;
    gap: var(--tn-spacing-xs);
    margin-bottom: var(--tn-spacing-sm);
    font-weight: 500;
    color: var(--text-normal);
}

.tasknotes-webhook-help-list {
    margin: var(--tn-spacing-sm) 0;
    padding-left: var(--tn-spacing-lg);
    color: var(--text-muted);
    font-size: var(--tn-font-size-sm);
}

.tasknotes-webhook-help-list li {
    margin-bottom: var(--tn-spacing-xs);
}

.tasknotes-webhook-help-example {
    margin-top: var(--tn-spacing-sm);
    font-size: var(--tn-font-size-sm);
    color: var(--text-muted);
}

.tasknotes-webhook-modal-buttons {
    display: flex;
    gap: var(--tn-spacing-sm);
    justify-content: flex-end;
    margin-top: var(--tn-spacing-xl);
    padding-top: var(--tn-spacing-md);
    border-top: 1px solid var(--background-modifier-border);
}

.tasknotes-webhook-modal-btn {
    display: flex;
    align-items: center;
    gap: var(--tn-spacing-xs);
    padding: var(--tn-spacing-sm) var(--tn-spacing-lg);
    border: 1px solid var(--background-modifier-border);
    border-radius: var(--tn-radius-sm);
    background: var(--background-primary);
    color: var(--text-normal);
    font-size: var(--tn-font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tasknotes-webhook-modal-btn:hover {
    background: var(--background-modifier-hover);
    border-color: var(--interactive-accent);
}

.tasknotes-webhook-modal-btn.save {
    background: var(--interactive-accent);
    color: var(--text-on-accent);
    border-color: var(--interactive-accent);
}

.tasknotes-webhook-modal-btn.save:hover {
    background: var(--interactive-accent-hover);
    border-color: var(--interactive-accent-hover);
}

.tasknotes-webhook-modal-btn.cancel {
    background: transparent;
}

.tasknotes-webhook-modal-btn.cancel:hover {
    background: var(--background-modifier-hover);
}

.tasknotes-webhook-modal-btn-icon {
    font-size: 0.9rem;
    line-height: 1;
}

/* Webhook Secret Notice */
.tasknotes-webhook-secret-notice {
    text-align: center;
    padding: var(--tn-spacing-xl);
}

.tasknotes-webhook-secret-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--tn-spacing-sm);
    margin-bottom: var(--tn-spacing-lg);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--interactive-accent);
}

.tasknotes-webhook-secret-content {
    margin-bottom: var(--tn-spacing-lg);
}

.tasknotes-webhook-secret-content p {
    margin-bottom: var(--tn-spacing-md);
    color: var(--text-normal);
}

.tasknotes-webhook-secret-code {
    display: block;
    background: var(--background-modifier-form-field);
    padding: var(--tn-spacing-md);
    border-radius: var(--tn-radius-sm);
    font-family: var(--font-monospace);
    font-size: var(--tn-font-size-sm);
    word-break: break-all;
    user-select: all;
    border: 1px solid var(--background-modifier-border);
    margin: var(--tn-spacing-md) 0;
    cursor: pointer;
}

.tasknotes-webhook-secret-code:hover {
    background: var(--background-modifier-hover);
    border-color: var(--interactive-accent);
}

/* ================================================
   HELPER TEXT & WARNING SECTIONS
   ================================================ */

/* Help sections with lists */
.tasknotes-settings__help-section {
    background: var(--background-secondary);
    border-radius: 6px;
    padding: 16px;
    margin: 12px 0;
}

.tasknotes-settings__help-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-normal);
}

.tasknotes-settings__help-section ul {
    margin: 0;
    padding-left: 20px;
}

.tasknotes-settings__help-section li {
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.tasknotes-settings__help-note {
    margin: 12px 0 0 0;
    padding: 12px;
    background: var(--background-modifier-form-field);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-muted);
    border: 1px solid var(--background-modifier-border);
}

/* Warning sections */
.tasknotes-settings__warning {
    background: rgba(var(--color-red-rgb), 0.1);
    border: 1px solid rgba(var(--color-red-rgb), 0.3);
    border-radius: 6px;
    padding: 16px;
    margin: 12px 0;
    font-size: 13px;
    color: var(--text-normal);
    line-height: 1.4;
}

.tasknotes-settings__warning strong {
    color: var(--color-red);
}

/* ================================================
   FIELD MAPPING TABLE - CARD STYLE
   ================================================ */

.tasknotes-settings__table {
    background: var(--background-primary);
    border: 1px solid var(--background-modifier-border);
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.tasknotes-settings__table-header {
    background: var(--background-secondary);
    color: var(--text-normal);
    font-weight: 600;
    font-size: 13px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--background-modifier-border);
    position: sticky;
    top: 0;
    z-index: 1;
}

.tasknotes-settings__table-header:first-child {
    min-width: 140px;
    width: 35%;
}

.tasknotes-settings__table-header:last-child {
    width: 65%;
}

.tasknotes-settings__table-row {
    transition: background-color 0.2s ease;
}

.tasknotes-settings__table-row:nth-child(even) {
    background: var(--background-modifier-form-field);
}

.tasknotes-settings__table-row:hover {
    background: var(--background-modifier-hover);
}

.tasknotes-settings__table-cell {
    padding: 12px 16px;
    border-bottom: 1px solid var(--background-modifier-border);
    vertical-align: middle;
    font-size: 13px;
}

.tasknotes-settings__table-cell:first-child {
    font-weight: 500;
    color: var(--text-normal);
    background: var(--background-modifier-form-field);
}

.tasknotes-settings__table-cell:last-child {
    background: inherit;
}

/* Remove border from last row */
.tasknotes-settings__table-row:last-child .tasknotes-settings__table-cell {
    border-bottom: none;
}

/* Field mapping input styling */
.field-mapping-input {
    width: 100%;
} 

.field-mapping-input:hover {
    border-color: var(--interactive-hover);
}

.field-mapping-input::placeholder {
    color: var(--text-faint);
    font-style: italic;
    opacity: 0.7;
}

/* ================================================
   DEFAULT VISIBLE PROPERTIES STYLING
   ================================================ */

.tasknotes-settings__properties-container {
    margin: 16px 0;
}

.tasknotes-settings__property-group {
    margin-bottom: 20px;
}

.tasknotes-settings__property-group-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--background-modifier-border);
}

.tasknotes-settings__property-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.tasknotes-settings__property-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.tasknotes-settings__property-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

.tasknotes-settings__property-label {
    font-size: 13px;
    color: var(--text-normal);
    cursor: pointer;
    flex: 1;
    line-height: 1.3;
}

.tasknotes-settings__property-label:hover {
    color: var(--text-accent);
}

/* ================================================
   COLLAPSIBLE SECTIONS
   ================================================ */

.tasknotes-settings__collapsible-header {
    cursor: pointer;
    padding: 8px 12px;
    margin: -8px -12px 12px -12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.tasknotes-settings__collapsible-header:hover {
    background: var(--background-modifier-hover);
}

.tasknotes-settings__collapsible-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tasknotes-settings__collapsible-icon {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    font-family: monospace;
    line-height: 1;
}

.tasknotes-settings__collapsible-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-normal);
    margin: 0;
}

.tasknotes-settings__collapsible-content {
    transition: all 0.2s ease;
}

/* ================================================
   ACCESSIBILITY & REDUCED MOTION
   ================================================ */

@media (prefers-reduced-motion: reduce) {
    .tasknotes-plugin .settings-view__tab-content--active {
        animation: none;
    }
    
    .tasknotes-settings__card,
    .tasknotes-settings__card-drag-handle {
        transition: none;
    }
}