/* ========== TRELLO DESIGN TOKENS ========== */
:root {
    --ds-surface: #ffffff;
    --ds-surface-overlay: #ffffff;
    --ds-background-neutral: rgba(9,30,66,0.06);
    --ds-background-neutral-hovered: rgba(9,30,66,0.14);
    --ds-text: #172b4d;
    --ds-text-subtle: #44546f;
    --ds-text-subtlest: #626f86;
    --ds-border: rgba(9,30,66,0.14);
    --ds-shadow-raised: 0px 1px 1px rgba(9,30,66,0.25), 0px 0px 1px rgba(9,30,66,0.31);
    --ds-shadow-overlay: 0px 8px 12px rgba(9,30,66,0.15), 0px 0px 1px rgba(9,30,66,0.31);
    --ds-radius-small: 3px;
    --ds-radius-large: 8px;
    --ds-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, "Droid Sans", "Helvetica Neue", sans-serif;
}

/* ========== BOARD LAYOUT ========== */
#trello-dashboard {
    font-family: var(--ds-font-family);
    font-size: 14px;
    color: var(--ds-text);
    padding: 8px 4px 8px 12px;
    height: calc(100vh - 80px);
    overflow: hidden;
    box-sizing: border-box;
}

#trello-board-name h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--ds-text);
    margin: 0 0 8px 0;
    line-height: 24px;
}

#trello-loading {
    padding: 16px;
    color: var(--ds-text-subtle);
    font-size: 14px;
}

/* ========== COLUMNS (LISTS) ========== */
.trello-columns {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    flex-wrap: nowrap;
}

.trello-column {
    display: flex;
    flex-direction: column;
    width: 272px;
    min-width: 272px;
    max-width: 272px;
    max-height: 100%;
    background-color: #f1f2f4;
    border-radius: 12px;
    box-shadow: var(--ds-shadow-raised);
    flex-shrink: 0;
    box-sizing: border-box;
    padding: 0;
}

/* ========== LIST HEADER ========== */
.trello-column-header {
    padding: 10px 8px 6px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ds-text);
    line-height: 20px;
    min-height: 40px;
    display: flex;
    align-items: center;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    word-break: break-word;
    flex-shrink: 0;
}

/* ========== CARDS CONTAINER ========== */
.trello-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 8px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 4px;
    max-height: calc(100% - 80px);
    scrollbar-width: thin;
    scrollbar-color: rgba(9,30,66,0.14) rgba(9,30,66,0.06);
}

.trello-cards::-webkit-scrollbar { width: 6px; }
.trello-cards::-webkit-scrollbar-thumb {
    background: rgba(9,30,66,0.2);
    border-radius: 3px;
}

/* ========== INDIVIDUAL CARD ========== */
.trello-card {
    display: block;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: var(--ds-shadow-raised);
    padding: 8px 8px 4px 12px;
    cursor: pointer;
    color: var(--ds-text);
    text-decoration: none;
    font-size: 14px;
    line-height: 20px;
    word-break: break-word;
    transition: background-color 85ms ease;
}

.trello-card:hover {
    background-color: #f1f2f4;
}

.trello-card strong {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #172b4d;
    line-height: 20px;
    margin-bottom: 4px;
    word-break: break-word;
}

.trello-card p {
    margin: 2px 0 4px 0;
    font-size: 12px;
    color: var(--ds-text-subtle);
    line-height: 16px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.trello-card .due-date {
    display: inline-block;
    font-size: 12px;
    color: var(--ds-text-subtle);
    line-height: 16px;
    margin-top: 4px;
    padding: 2px 6px;
    background: rgba(9,30,66,0.06);
    border-radius: 3px;
    margin-bottom: 4px;
}

/* ========== ADD CARD BUTTON ========== */
.add-card-btn {
    display: flex;
    align-items: center;
    width: calc(100% - 16px);
    margin: 4px 8px 8px 8px;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--ds-text-subtle);
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    line-height: 20px;
    transition: background-color 85ms ease;
    flex-shrink: 0;
}

.add-card-btn:before {
    content: "+";
    margin-right: 6px;
    font-size: 16px;
    font-weight: 700;
}

.add-card-btn:hover {
    background-color: rgba(9,30,66,0.14);
    color: var(--ds-text);
}

/* ========== DRAG AND DROP ========== */
.trello-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.trello-cards.drag-over {
    background-color: rgba(9,30,66,0.08);
    border-radius: 8px;
}

/* ========== MODAL OVERLAY ========== */
#trello-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.56);
    z-index: 99998;
}

/* ========== CARD MODAL WINDOW ========== */
#trello-card-modal {
    display: none;
    position: fixed;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    width: 768px;
    max-width: 95vw;
    max-height: calc(100vh - 96px);
    background-color: #f1f2f4;
    border-radius: 12px;
    box-shadow: var(--ds-shadow-overlay);
    z-index: 99999;
    overflow-y: auto;
    font-family: var(--ds-font-family);
    box-sizing: border-box;
}

/* Modal Header Area */
.modal-header {
    display: flex;
    align-items: flex-start;
    padding: 16px 16px 8px 56px;
    position: relative;
    min-height: 40px;
}

.modal-card-icon {
    position: absolute;
    left: 16px;
    top: 18px;
    font-size: 18px;
    color: var(--ds-text-subtle);
}

#modal-title {
    flex: 1;
    font-size: 20px;
    font-weight: 600;
    color: var(--ds-text);
    line-height: 24px;
    margin: 0 32px 0 0;
    word-break: break-word;
}

#modal-close {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: var(--ds-text-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#modal-close:hover {
    background-color: rgba(9,30,66,0.14);
    color: var(--ds-text);
}

/* Modal Body (two columns like real Trello) */
.modal-body {
    display: flex;
    flex-direction: row;
    gap: 0;
    padding: 0 8px 16px 8px;
}

/* Left content column */
.modal-main {
    flex: 1;
    min-width: 0;
    padding: 0 8px 0 48px;
}

/* Right sidebar */
.modal-sidebar {
    width: 168px;
    flex-shrink: 0;
    padding: 8px;
}

/* ========== MODAL SECTIONS ========== */
.modal-section {
    margin-bottom: 24px;
}

.modal-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--ds-text-subtle);
    line-height: 16px;
    margin-bottom: 4px;
    margin-top: 12px;
}

.modal-section textarea#modal-desc {
    width: 100%;
    min-height: 108px;
    padding: 8px 12px;
    border-radius: 3px;
    border: none;
    background-color: rgba(9,30,66,0.06);
    box-shadow: none;
    font-size: 14px;
    font-family: var(--ds-font-family);
    color: var(--ds-text);
    line-height: 20px;
    resize: vertical;
    box-sizing: border-box;
    transition: background-color 85ms ease, box-shadow 85ms ease;
}

.modal-section textarea#modal-desc:focus {
    background-color: #fff;
    box-shadow: inset 0 0 0 2px #0c66e4;
    outline: none;
}

/* Due date row in modal */
#modal-due {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 8px;
    background-color: rgba(9,30,66,0.06);
    border-radius: 3px;
    font-size: 14px;
    color: var(--ds-text);
    line-height: 32px;
    margin-top: 4px;
    font-weight: 500;
}

/* Trello link */
#modal-trello-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    font-size: 14px;
    color: #0c66e4;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
}

#modal-trello-link:hover {
    background-color: rgba(9,30,66,0.06);
    text-decoration: underline;
}

/* Save button */
#modal-save-desc {
    margin-top: 8px;
    padding: 6px 12px;
    background-color: #0c66e4;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    line-height: 20px;
}

#modal-save-desc:hover { background-color: #0055cc; }

#modal-save-confirm {
    display: none;
    color: #1f845a;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 600;
}

/* Sidebar buttons */
.modal-sidebar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 12px;
    margin-bottom: 4px;
    background-color: rgba(9,30,66,0.06);
    border: none;
    border-radius: 3px;
    font-size: 14px;
    color: var(--ds-text);
    cursor: pointer;
    text-align: left;
    line-height: 20px;
}

.modal-sidebar-btn:hover {
    background-color: rgba(9,30,66,0.14);
}

.modal-sidebar-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--ds-text-subtle);
    margin-bottom: 6px;
    margin-top: 12px;
    display: block;
}

/* Hidden input */
#modal-card-id { display: none; }