@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@500;600;700&display=swap');

:root {
    /* --- TROPICAL FOREST & BANANA PALETTE --- */
    --forest-deep: #224524;    /* Deep canopy background & active dark buttons */
    --forest-mid: #2C5E2F;     /* Secondary borders and accents */
    --forest-light: #4A7C59;   /* Fresh forest highlight lines */
    --banana-paper: #fff8cb;   /* Rich golden banana-yellow parchment paper */
    --banana-line: #eae8d4f3;    /* Distinct ruled line color */
    --jungle-text: #0D230F;    /* Deep dark text and headings */
    --pure-white: #fefdf3;     /* Crisp white reserved strictly for checkboxes */
    --soft-cream: #fbfee5;     /* Soft warm tint for input boxes and items on paper */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Quicksand', sans-serif;
}

body {
    background-color: var(--forest-deep);
    background-image: radial-gradient(var(--forest-mid) 1.5px, transparent 1.5px);
    background-size: 26px 26px;
    color: var(--jungle-text);
    display: flex;
    justify-content: center;
    padding: 24px 16px;
    min-height: 100vh;
}

/* Floating Navigation Link (Top Left Corner) */
.floating-back-link {
    position: fixed;
    top: 20px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: var(--banana-line);
    border: 2px solid var(--forest-mid);
    border-radius: 14px;
    color: var(--jungle-text);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(20, 54, 22, 0.3);
    z-index: 50;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.floating-back-link:hover {
    transform: translateY(-2px);
    background-color: var(--soft-cream);
}

/* Floating Tabs Bar (Top Center) */
.floating-tabs-bar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.view-tabs {
    display: flex;
    gap: 6px;
    background: var(--banana-paper);
    padding: 6px;
    border: 2px solid var(--forest-mid);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(20, 54, 22, 0.3);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--forest-deep);
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn.active {
    background: var(--forest-deep);
    color: var(--banana-paper);
}

/* Desk Container */
.desk-container {
    width: 100%;
    max-width: 1140px;
    margin: 68px auto 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Desk Layout Workspaces */
.desk-workspace {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
}

/* Side Column for Left Papers */
.side-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

@media (max-width: 880px) {
    .desk-workspace {
        flex-direction: column;
        align-items: center;
    }
}

.calendar-workspace.hidden,
.desk-workspace.hidden {
    display: none;
}

/* Skeuomorphic Paper Sheets */
.paper-sheet {
    background: var(--banana-paper);
    background-image: linear-gradient(var(--banana-line) 1px, transparent 1px);
    background-size: 100% 28px;
    line-height: 28px;
    border: 2px solid var(--forest-mid);
    border-radius: 16px;
    padding: 24px 20px;
    box-shadow: 0 10px 25px rgba(20, 54, 22, 0.25);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.side-paper {
    width: 100%;
    min-height: 240px;
    transform: rotate(-0.6deg);
}

.finished-paper {
    transform: rotate(0.6deg);
}

/* Prominent Focus Paper */
.main-paper {
    flex: 1.6;
    width: 100%;
    min-height: 560px;
    box-shadow: 0 14px 30px rgba(20, 54, 22, 0.3);
    z-index: 2;
    border: 3px solid var(--forest-deep);
}

.paper-pin {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
}

.paper-header h2 {
    color: var(--jungle-text);
    font-size: 1.25rem;
}

.paper-subtitle {
    font-size: 0.78rem;
    color: var(--forest-deep);
    display: block;
    line-height: 1.2;
}

/* Input Rows */
.paper-input-row {
    display: flex;
    gap: 8px;
    align-items: center; /* Aligns input and button cleanly */
}

.paper-input-row input {
    /* Change flex: 1 to width settings so it doesn't span full width */
    width: 220px;            /* Gives a nice initial width for typing */
    max-width: 100%;
    background: var(--pure-white);
    border: 2px solid var(--forest-mid);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    color: var(--jungle-text);
    outline: none;
    transition: border-color 0.15s ease, width 0.15s ease;
}

/* Optional: Expands slightly when clicked for a nice tactile feel */
.paper-input-row input:focus {
    border-color: var(--forest-deep);
}

/* Buttons */
.cozy-btn {
    background: var(--forest-deep);
    color: var(--soft-cream);
    border: 2px solid var(--forest-deep);
    padding: 6px 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.1s, background-color 0.15s;
}

.cozy-btn:hover {
    background: var(--forest-mid);
}

/* List Drop Wrapper & Extension Edges */
.list-drop-wrapper {
    min-height: 180px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.paper-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
}

.paper-item {
    background: var(--soft-cream);
    border: 2px dashed var(--forest-mid);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: grab;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    align-self: flex-start;  /* Keeps the card sized strictly to its contents */
    width: fit-content;      /* Shrinks the box down to match the text length */
    max-width: 100%;
    margin-left: 26px;
    margin-right: 12px;
}

.paper-item:active {
    cursor: grabbing;
}

.paper-item.dragging {
    opacity: 0.35;
    transform: scale(0.97);
}

/* Instead of shifting margins which causes jitter, use clear lift and shadow or clean spacing */
.paper-item.drag-over-top {
    border-top: 4px solid var(--forest-deep);
    transform: translateY(6px);
}

.paper-item.drag-over-bottom {
    border-bottom: 4px solid var(--forest-deep);
    transform: translateY(-6px);
}

/* Drag Placeholder Gap (True full-size slot preview) */
.paper-item-placeholder {
    width: 100%;
    min-height: 44px;
    border: 2px dashed var(--forest-light);
    border-radius: 12px;
    background: rgba(74, 124, 89, 0.12);
    margin-left: 20px;
    margin-right: 12px;
    margin-top: 4px;
    margin-bottom: 4px;
    pointer-events: none; /* CRITICAL: Prevents mouse flicker and jitter! */
    transition: all 0.15s ease;
}

/* Big Checkmark - Inner area explicitly pure white */
.cozy-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--forest-deep);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background: var(--pure-white);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--forest-deep);
    user-select: none;
    flex-shrink: 0;
}

.paper-item.is-done {
    cursor: default;
    border-style: solid;
    background: var(--banana-line);
}

.paper-item.is-done .item-text {
    text-decoration: line-through;
    color: var(--forest-mid);
}

/* Paper sheet darkens when a dragged item hovers over it */
.paper-sheet.drag-over-paper {
    transform: scale(1.01) rotate(0deg);
    filter: brightness(0.92); /* Darkens the paper sheet slightly */
    box-shadow: 0 15px 35px rgba(20, 54, 22, 0.4);
    transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}


/* Someday paper tilts slightly when dragging an item over it */
.paper-sheet.tilt-over-paper {
    transform: rotate(-0.5deg) scale(1.02);
    box-shadow: 0 15px 35px rgba(20, 54, 22, 0.35);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.item-text {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--jungle-text);
    line-height: 1.3;
}

/* Monthly Calendar View */
.full-calendar-paper {
    width: 100%;
    min-height: 600px;
}

.calendar-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px dashed var(--forest-mid);
}

.nav-arrow-btn {
    background: var(--banana-line);
    border: 2px solid var(--forest-deep);
    padding: 6px 16px;
    border-radius: 12px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--jungle-text);
    transition: background 0.15s;
}

.nav-arrow-btn:hover {
    background: var(--soft-cream);
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    color: var(--forest-deep);
    font-size: 0.85rem;
    padding: 6px 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* Calendar day cells use soft cream tint */
.calendar-day-cell {
    background: var(--pure-white);
    border: 1.5px solid var(--banana-line);
    border-radius: 10px;
    min-height: 85px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendar-day-cell.other-month {
    opacity: 0.35;
    background: rgba(250, 246, 210, 0.5);
}

.day-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--forest-deep);
}

.day-accomplishment-badge {
    background: var(--banana-line);
    border: 1px solid var(--forest-deep);
    color: var(--forest-deep);
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    max-width: 100%;
    
    /* Default state: truncated to a single line */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.15s ease;
}

.day-accomplishment-badge:hover {
    background: var(--soft-cream);
}

/* When expanded via click, let it wrap to show full text */
.day-accomplishment-badge.expanded {
    white-space: normal;
    word-break: break-word;
    overflow: visible;
}


/* Floating Trash Bin (Top Right Corner) */
.floating-trash-bin {
    position: fixed;
    top: 20px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background-color: var(--soft-cream);
    border: 2px solid var(--forest-mid);
    border-radius: 14px;
    color: var(--jungle-text);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(20, 54, 22, 0.3);
    z-index: 50;
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

/* Trash bin highlights when hovering a dragged item over it */
.floating-trash-bin.drag-over-trash {
    background-color: #f8d7da;
    border-color: #a71d2a;
    color: #a71d2a;
    transform: scale(1.05);
}