﻿/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f5dc 0%, #f0e68c 100%);
    min-height: 100vh;
    color: #000;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    animation: modalSlideIn 0.3s ease-out;
}

/* Action Modal - Compact Layout */
.action-modal-content {
    max-width: 450px;
    position: relative;
}

.action-modal-body {
    padding: 20px;
}

.action-type-group {
    margin-bottom: 1rem;
}

.action-type-group label {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.action-type-group select {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Note Input Container - Styled as Note */
.note-input-container {
    background-image: url('images/note-bg.png');
    background-repeat: no-repeat;
    background-size: cover;
    border-radius: 0;
    padding: 1rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    min-height: 150px;
    position: relative;
}

.note-input-container.large-note {
    min-height: 220px;
}

.note-title-input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    color: #000;
}

.note-title-input:focus {
    outline: 2px solid rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.8);
}

.note-description-input {
    width: 100%;
    min-height: 100px;
    padding: 0.5rem;
    border: none;
    background: transparent;
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #000;
    font-family: inherit;
}

.note-description-input:focus {
    outline: none;
}

.note-description-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

/* Date Chips */
.date-chips-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.date-chip {
    padding: 0.5rem 1rem;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #333;
    transition: all 0.2s;
    font-weight: 500;
}

.date-chip:hover {
    background-color: #e0e0e0;
    border-color: #999;
    transform: translateY(-1px);
}

.date-chip.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* Compact Form Groups */
.compact-group {
    margin-bottom: 1rem;
}

.compact-group label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

/* Action buttons */
.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    font-weight: bold;
}

.icon-tick, .icon-cross {
    display: inline-block;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #333;
}

/* Top-right action buttons for action modal */
.modal-top-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.action-btn-top {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn-top:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.save-btn-top {
    color: #4caf50;
}

.save-btn-top:hover {
    color: #45a049;
}

.close-btn-top-right {
    color: #666;
}

.close-btn-top-right:hover {
    color: #333;
}

.modal-body {
    padding: 30px;
}

/* Authentication Styles */
.auth-container {
    text-align: center;
}

.auth-container h2 {
    margin-bottom: 30px;
    color: #000;
    font-weight: 600;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f5f5f5;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn.active {
    background-color: #667eea;
    color: white;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.auth-btn:hover {
    background-color: #5a6fd8;
}

.auth-error {
    margin-top: 16px;
    padding: 12px;
    background-color: #ffebee;
    color: #c62828;
    border-radius: 8px;
    display: none;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    color: #000;
    font-size: 1.8rem;
    font-weight: 700;
}

.app-header h1 i {
    color: #ffeb3b;
    margin-right: 0.5rem;
}

.app-header h1 .header-logo {
    height: 2.88rem;
    width: auto;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

#settingsBtn {
    min-width: 48px;
    padding: 0.75rem;
    justify-content: center;
}

#settingsBtn i {
    font-size: 1.1rem;
}

/* Template Dropdown Styles */
.template-dropdown {
    position: relative;
    display: inline-block;
}

.template-dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 8px;
    overflow: hidden;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
}

.template-dropdown-content button {
    width: 100%;
    border-radius: 0;
    border: none;
    background: #f9f9f9;
    color: #000;
    padding: 0.75rem 1rem;
    text-align: left;
    transition: background-color 0.2s;
}

.template-dropdown-content button:hover {
    background-color: #e0e0e0;
}

.template-dropdown:hover .template-dropdown-content {
    display: block;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: #f2e9a5;
    color: #000;
}

.btn-primary:hover {
    background-color: #fbc02d;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #000;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

/* Board Container */
.board-container {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.board {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    justify-content: flex-start;
    align-items: flex-start;
}




/* Section Styles */
.section {
    background: #fefefe;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-height: 400px;
    width: 300px;
    flex: 0 0 300px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Hide Requires Attention section by default */
.section[data-section="requires-attention"] {
    display: none;
}

/* Lined Paper Effect */
.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(to bottom, transparent 0%, transparent 24px, #e0e0e0 24px, #e0e0e0 25px, transparent 25px);
    background-size: 100% 25px;
    pointer-events: none;
    border-radius: 12px;
    opacity: 0.3;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.section-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.section-header h3 {
    color: #000;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.count {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Checkbox Styles */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.75rem;
    color: #000;
    user-select: none;
    white-space: nowrap;
    margin-left: 0.5rem;
}

.checkbox-container input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 14px;
    height: 14px;
    background-color: #fff;
    border: 2px solid #ffc107;
    border-radius: 3px;
    margin-right: 6px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark {
    background-color: #ffc107;
    border-color: #ffc107;
}

.checkbox-container input[type="checkbox"]:checked + .checkmark:after {
    content: "";
    position: absolute;
    left: 3px;
    top: 0px;
    width: 3px;
    height: 6px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.help-icon {
    color: #666;
    font-size: 12px;
    margin-left: 4px;
    cursor: help;
    transition: color 0.2s ease;
}

.help-icon:hover {
    color: #333;
}

/* Clickable Date Styles */
.clickable-date {
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.clickable-date:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.section-content {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
    position: relative;
    z-index: 1;
}

/* Post-it Note Styles */
.note {
    background-image: url('images/note-bg.png');
    background-repeat: no-repeat;
    background-size: cover;
    border-radius: 0;
    padding: 1.75rem; /* Increased from 1rem (16px) to 1.75rem (28px) - 12dp increase */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.15);
    cursor: grab;
    transition: all 0.2s;
    position: relative;
    border: 2px solid rgba(0, 0, 0, 0.1);
    width: 180px;
    height: 120px; /* Fixed height for basic notes */
    min-height: 120px;
    display: flex;
    flex-direction: column;
    margin-bottom: -60px; /* 50% of 120px height for overlap */
    z-index: 1;
    overflow: hidden; /* Hide content that exceeds the fixed height */
    --offset-x: 0px; /* Default horizontal offset - will be overridden by inline style */
    transform: translateX(var(--offset-x)); /* Apply horizontal offset while maintaining note width */
}

.note:hover {
    transform: translateX(var(--offset-x)) translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 10; /* Bring hovered note to front */
}

/* Add a subtle hint that the basic note can be expanded */
.note.basic:not(:hover)::before {
    content: '';
    display: none;
}

/* Basic note hover state - expand to show full content */
.note.basic:hover {
    height: auto;
    min-height: 120px;
    max-height: none; /* Allow note to extend to show all text content */
    overflow: visible;
    z-index: 15;
    transform: translateX(var(--offset-x)) translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25), 0 3px 8px rgba(0, 0, 0, 0.2);
}

.note.dragging {
    opacity: 0.5;
    transform: translateX(var(--offset-x)) rotate(5deg) scale(1.05);
    cursor: grabbing;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: none;
}

.note.drag-over-target {
    transform: translateX(var(--offset-x)) scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.note.large {
    width: 270px;
    height: 200px; /* Increased height for better content display */
    min-height: 200px;
    margin-bottom: -100px; /* 50% of 200px height for overlap */
    overflow: hidden; /* Hide content that exceeds the fixed height */
    transition: height 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer; /* Indicate that the note is clickable */
}

/* Add a subtle hint that the large note can be expanded */
.note.large:not(:hover)::before {
    content: '';
    display: none;
}

/* Large note hover state - expand automatically */
.note.large:hover {
    height: auto;
    min-height: 200px; /* Maintain the increased height */
    max-height: none; /* Allow note to extend to show all text content */
    overflow: visible;
    z-index: 15;
    transform: translateX(var(--offset-x)) translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25), 0 3px 8px rgba(0, 0, 0, 0.2);
}

.note.custom {
    height: 120px; /* Fixed height for custom notes */
    overflow: hidden; /* Hide content that exceeds the fixed height */
    transition: height 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer; /* Indicate that the note is clickable */
}

/* Add a subtle hint that the note can be expanded */
.note.custom:not(.expanded):not(:hover)::before {
    content: '';
    display: none;
}

/* Custom note expanded state */
.note.custom.expanded {
    height: auto;
    min-height: 120px;
    max-height: none; /* Allow note to extend to show all text content */
    overflow: visible;
    z-index: 20; /* Bring expanded note to front */
    transform: translateX(var(--offset-x)) translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28), 0 4px 10px rgba(0, 0, 0, 0.22);
}

/* Custom note hover state - expand automatically */
.note.custom:hover {
    height: auto;
    min-height: 120px;
    max-height: none; /* Allow note to extend to show all text content */
    overflow: visible;
    z-index: 15;
    transform: translateX(var(--offset-x)) translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25), 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* Custom note content fade effect for truncated content */
.note.custom .note-content {
    position: relative;
}

.note.custom:not(.expanded):not(:hover) .note-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, rgba(255, 255, 255, 0));
    pointer-events: none;
}

/* Custom note specific styles */
.note.custom {
    position: relative; /* Ensure note is positioned for absolute chip */
}

.note.custom .note-content {
    position: relative;
    /* No padding-top needed - chip is positioned outside note-content */
}

/* Template Title Chip - Top Right */
.note.custom .note-template-title-chip {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 0.1rem 0.3rem;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #000;
    z-index: 10;
    box-shadow: none;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom note title - aligned with margin */
.note.custom .note-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    margin-left: -1.25rem; /* Align with Action Date position (0.5rem from note edge) - note padding is 1.75rem */
    margin-top: 0;
    color: #000;
}

/* Key Action Field - below title, always visible */
.note-key-action-field {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
    margin-top: 0;
    margin-left: -1.25rem; /* Align with title margin */
}

/* Key Text fields - below Key Action field, always visible */
.note.custom .note-key-text-field {
    font-size: 0.8rem;
    color: #555;
    margin: 0.2rem 0;
    margin-left: -1.25rem; /* Align with title margin */
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    display: block;
}

.note-key-text-field .field-label {
    font-weight: 500;
    color: #666;
}

/* Custom note description - aligned with margin */
.note.custom .note-description {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #000;
    margin-bottom: 0.5rem;
    margin-left: -1.25rem; /* Align with title margin */
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Expanded fields - hidden by default, shown when expanded/selected */
.note-expanded-fields {
    display: none;
    margin-top: 0.5rem;
    margin-left: -1.25rem; /* Align with title margin */
}

.note.custom.expanded .note-expanded-fields,
.note.custom:hover .note-expanded-fields {
    display: block;
}

/* Key Named dates - shown when selected */
.note-key-dates {
    font-size: 0.8rem;
    color: #555;
    margin: 0.5rem 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.note-key-date-item {
    margin: 0.25rem 0;
}

/* Stage - shown when selected */
.note.custom .note-stage {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    margin: 0.5rem 0 0.25rem 0;
}

/* Action Date with edit icon inline - shown when selected */
.note-action-date-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: #555;
}

.note-action-date-text {
    font-weight: 500;
}

.note-action-date-edit {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 0;
    transition: background 0.2s;
}

.note-action-date-edit:hover {
    background: rgba(0, 0, 0, 0.2);
}

.note-action-date-edit i {
    color: #333;
}

/* Regular note title - for non-custom notes */
.note-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    margin-left: -1.25rem; /* Align with Action Date position (0.5rem from note edge) - note padding is 1.75rem */
    color: #000;
}

/* Regular note description - for non-custom notes */
.note-description {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #000;
    margin-bottom: 0.5rem;
    margin-left: -1.25rem; /* Align with Action Date position (0.5rem from note edge) - note padding is 1.75rem */
    white-space: pre-line; /* Preserve line breaks and wrap text */
    word-wrap: break-word; /* Break long words/URLs */
    overflow-wrap: break-word; /* Modern browsers */
    hyphens: auto; /* Add hyphens for better word breaking */
}

/* Style for clickable links within notes */
.note-description a {
    color: #0066cc;
    text-decoration: underline;
    word-break: break-all; /* Break URLs at any character */
}

.note-description a:hover {
    color: #004499;
    text-decoration: none;
}

.note-date {
    font-size: 0.8rem;
    color: #000;
    font-weight: 500;
    display: none; /* Hidden by default */
}

/* Show date when note is hovered (basic/large) or expanded (custom) */
.note:hover .note-date.clickable-date,
.note.expanded .note-date.clickable-date {
    display: block;
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    right: auto;
}

.note-actions {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.note:hover .note-actions {
    opacity: 1;
}

.note-action-btn {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: #000;
    transition: all 0.2s;
}

.note-action-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #000;
}


/* Drop Zone Styles */
.section-content.drag-over {
    background: rgba(0, 0, 0, 0.05);
    border: 2px dashed rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    position: relative;
}

.section-content.drag-over::after {
    content: 'Drop here to add to this section';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 100;
}

/* Insertion Indicator */
.insertion-indicator {
    position: fixed;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
    z-index: 1000;
    pointer-events: none;
    animation: insertionPulse 1s ease-in-out infinite alternate;
}

@keyframes insertionPulse {
    from {
        opacity: 0.6;
        box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
    }
    to {
        opacity: 1;
        box-shadow: 0 0 12px rgba(102, 126, 234, 0.8);
    }
}

/* Completion, Delete, and Left Message Zones */
.completion-zone,
.delete-zone,
.left-message-zone {
    position: fixed;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.completion-zone.active,
.delete-zone.active,
.left-message-zone.active {
    opacity: 1;
    pointer-events: all;
}

/* Complete zone - quarter circle in bottom-right corner */
.completion-zone {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    bottom: 0;
    right: 0;
    width: 138px;
    height: 138px;
    border-radius: 100% 0 0 0;
    transform: scale(0.8);
    box-shadow: -2px -2px 8px rgba(0, 0, 0, 0.2);
}

.completion-zone.active {
    transform: scale(1);
}

/* Delete zone - quarter circle in bottom-left corner */
.delete-zone {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    bottom: 0;
    left: 0;
    width: 138px;
    height: 138px;
    border-radius: 0 100% 0 0;
    transform: scale(0.8);
    box-shadow: 2px -2px 8px rgba(0, 0, 0, 0.2);
}

.delete-zone.active {
    transform: scale(1);
}

/* Left Message zone - box at bottom center, flush with bottom edge */
.left-message-zone {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    bottom: 0;
    left: 50%;
    width: 230px;
    height: 92px;
    border-radius: 12px 12px 0 0;
    transform: translateX(-50%) scale(0.8);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.left-message-zone.active {
    transform: translateX(-50%) scale(1);
}

.completion-content,
.delete-content,
.left-message-content {
    text-align: center;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.completion-content i,
.delete-content i,
.left-message-content i {
    font-size: 1.5rem;
    display: block;
}

.completion-content span,
.delete-content span,
.left-message-content span {
    font-size: 0.85rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #000;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .board {
        gap: 1rem;
        justify-content: center;
    }
    
    .section {
        width: 280px;
        flex: 0 0 280px;
        min-height: 350px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .completion-zone,
    .delete-zone {
        width: 115px;
        height: 115px;
    }
    
    .left-message-zone {
        width: 207px;
        height: 81px;
        bottom: 0;
    }
}

/* Animation for new notes */
@keyframes noteSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.note.new {
    animation: noteSlideIn 0.3s ease-out;
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: white;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Template Form Styles */
.named-date-item, .key-action-item, .key-text-field-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

/* Color Picker Styles */
.color-picker-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #ddd;
    background-color: #ffeb3b;
    transition: all 0.3s ease;
}

.color-preview:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.named-date-item input, .key-action-item input, .key-action-item select, .key-text-field-item input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.named-date-item .date-name, .key-action-item .action-name {
    flex: 2;
}

.key-action-item .action-date-ref {
    flex: 1.5;
}

.key-action-item .action-offset {
    flex: 1;
    text-align: center;
}

.remove-date-btn, .remove-action-btn, .remove-text-field-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.remove-date-btn:hover, .remove-action-btn:hover, .remove-text-field-btn:hover {
    background: #c82333;
}

/* Note Stage and Progress Styles */
.note-stage {
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
    margin: 0.25rem 0;
}

.note-progress {
    font-size: 0.8rem;
    color: #888;
    margin: 0.25rem 0;
}

/* Enhanced Note Display Styles */
.note-template-title {
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
    margin: 0.25rem 0;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
}

.note-key-text-field {
    font-size: 0.8rem;
    color: #555;
    margin: 0.2rem 0;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
}

.note-key-text-field .field-label {
    font-weight: 500;
    color: #666;
}

.note-key-dates {
    font-size: 0.75rem;
    color: #777;
    margin: 0.5rem 0 0.25rem 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}


/* Template Date Inputs */
#templateDateInputs {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

#templateDateInputs h4 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1rem;
}

/* Larger modal for template creation */
#templateModal .modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Form help text */
.form-help {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0;
    font-style: italic;
}

/* Color History Styles */
.color-history {
    margin-top: 1rem;
}

.color-history label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    display: block;
}

.color-history-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-history-chip {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.color-history-chip:hover {
    transform: scale(1.1);
    border-color: #333;
}

.color-history-chip.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
}

/* Date Shortcuts Styles */
.date-shortcuts {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.date-shortcut-btn {
    padding: 0.5rem 1rem;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #333;
    transition: all 0.2s;
}

.date-shortcut-btn:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

.date-shortcut-btn.active {
    background-color: #667eea;
    color: white;
    border-color: #667eea;
}

/* Recurring Action Styles */
.recurring-action {
    position: relative;
}

.note-recurring-icon {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: 14px;
    opacity: 0.8;
    z-index: 100;
    pointer-events: none;
    display: block !important;
    visibility: visible !important;
    line-height: 1;
}

.note-recurring {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    margin-left: -1.25rem; /* Align with description margin */
    padding: 0.25rem 0.5rem;
    background-color: rgba(255, 107, 107, 0.1);
    border-radius: 4px;
}

/* Recurring Fields in Modal */
#recurringFields {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

#recurringFields label {
    font-weight: 500;
    color: #495057;
}

#recurringNumber {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.5rem;
    text-align: center;
}

#recurringPeriod {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 0.5rem;
    background-color: white;
}

.form-help {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Calendar View Styles */
.calendar-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    padding: 1rem;
    min-height: calc(100vh - 80px);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 1rem;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calendar-nav-btn {
    background: transparent;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: #5f6368;
    transition: background-color 0.2s;
}

.calendar-nav-btn:hover {
    background-color: #f1f3f4;
}

.calendar-today-btn {
    background: transparent;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #5f6368;
    font-weight: 500;
    transition: background-color 0.2s;
}

.calendar-today-btn:hover {
    background-color: #f1f3f4;
}

.calendar-month-year {
    font-size: 1.375rem;
    font-weight: 400;
    color: #3c4043;
    margin: 0;
    min-width: 200px;
}

.calendar-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.calendar-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 100%;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.calendar-weekday {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 500;
    color: #70757a;
    text-transform: uppercase;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    flex: 1;
    overflow-y: auto;
    border-left: 1px solid #e0e0e0;
    border-top: 1px solid #e0e0e0;
}

.calendar-day {
    height: 200px;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    padding: 0.5rem;
    background: #fff;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-day.other-month {
    background: #f8f9fa;
    color: #9aa0a6;
}

.calendar-day.today {
    background: #e8f0fe;
}

.calendar-day.historic {
    background: #f5f5f5;
    opacity: 0.6;
}

.calendar-day.historic .calendar-day-number {
    color: #9aa0a6;
}

.calendar-day.drag-over {
    background-color: #e3f2fd;
    border: 2px dashed #2196f3;
}

.calendar-day-number {
    font-size: 0.875rem;
    font-weight: 500;
    color: #3c4043;
    margin-bottom: 0.25rem;
    padding: 0.25rem;
}

.calendar-day.today .calendar-day-number {
    background: #1a73e8;
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.calendar-day.other-month .calendar-day-number {
    color: #9aa0a6;
}

.calendar-events {
    display: flex;
    flex-wrap: nowrap;
    flex-direction: column;
    gap: 0;
    margin-top: 0.25rem;
    position: relative;
    height: calc(100% - 1.5rem);
    overflow-y: auto;
    overflow-x: hidden;
    align-content: flex-start;
}

.calendar-event {
    background-image: url('images/note-bg.png');
    background-repeat: no-repeat;
    background-size: cover;
    border-radius: 0;
    padding: 0.44rem 0.55rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
    cursor: move;
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    width: 121px;
    height: 79px;
    overflow: hidden;
    transition: all 0.3s ease;
    font-size: 0.715rem;
    line-height: 1.2;
    display: flex;
    flex-direction: column;
    margin-bottom: -15.8px;
    z-index: 1;
    flex-shrink: 0;
}

.calendar-event.basic {
    background-color: #ffeb3b;
}

.calendar-event.large {
    background-color: #ff9800;
    width: 139.15px; /* 15% bigger than 121px */
    height: 90.85px; /* 15% bigger than 79px */
}

.calendar-event.custom {
    background-color: #9c27b0;
}

.calendar-event.stage {
    background-color: #2196f3;
    font-size: 0.66rem;
    width: 121px;
    height: 66px;
    margin-left: 0;
    margin-bottom: -13.2px;
}

.calendar-event-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding-top: 0.2rem;
}

/* Basic notes - description should be below preview button */
.calendar-event.basic .calendar-event-content {
    margin-top: calc(4px + 18px + 0.2rem);
    padding-top: 0;
}

.calendar-event-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.2rem;
}

.calendar-event.expanded .calendar-event-title {
    white-space: normal;
    overflow: visible;
    word-wrap: break-word;
}

.calendar-event-description {
    font-size: 0.66rem;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    margin-top: 0.22rem;
}

.calendar-event.expanded .calendar-event-description {
    display: block;
    -webkit-line-clamp: none;
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
}

.calendar-event-time {
    font-size: 0.55rem;
    color: #5f6368;
    margin-top: 0.1rem;
}

.calendar-event-preview-icon {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: background 0.2s;
    font-size: 0.7rem;
}

.calendar-event-preview-icon:hover {
    background: rgba(0, 0, 0, 0.2);
}


.calendar-event.expanded {
    z-index: 1000;
    position: absolute;
    min-height: auto;
    max-height: none;
    height: auto;
    width: 242px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    overflow: hidden;
    padding: 0.66rem 0.77rem;
    margin-bottom: 0;
}

.calendar-event-template-chip {
    position: absolute;
    top: 4px;
    left: 28px; /* Preview icon ends at 22px (4px + 18px) + 6px margin = 28px */
    padding: 0.11rem 0.33rem;
    border-radius: 6px;
    font-size: 0.605rem;
    font-weight: 600;
    color: #000;
    z-index: 10;
    box-shadow: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
    box-sizing: border-box;
    /* Max width: note width (121px) - left position (28px) - right padding (6px) = 87px */
    max-width: 87px;
    min-width: 0;
}

/* Position title content below template chip for custom notes */
.calendar-event.custom .calendar-event-content,
.calendar-event.stage.custom .calendar-event-content {
    margin-top: calc(4px + 0.11rem + 0.605rem * 1.2 + 0.11rem + 0.1rem);
    padding-top: 0;
}

.calendar-event.expanded .calendar-event-template-chip {
    left: 28px; /* Preview icon ends at 22px (4px + 18px) + 6px margin = 28px */
    /* Max width: expanded note width (242px) - left position (28px) - right padding (6px) = 208px */
    max-width: 208px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    min-width: 0;
    box-sizing: border-box;
}

.calendar-event-key-action {
    font-size: 0.66rem;
    margin-top: 0.22rem;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event.expanded .calendar-event-key-action {
    white-space: normal;
    overflow: visible;
    word-wrap: break-word;
}

.calendar-event-text-fields {
    margin-top: 0.33rem;
    font-size: 0.66rem;
    display: none;
}

.calendar-event.expanded .calendar-event-text-fields {
    display: block;
}

.calendar-event-text-field {
    margin-top: 0.2rem;
    line-height: 1.3;
}

.calendar-event-text-field .field-label {
    font-weight: 600;
    margin-right: 0.3rem;
}


/* Responsive Calendar */

@media (max-width: 768px) {
    .calendar-view {
        padding: 0.5rem;
    }
    
    .calendar-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .calendar-day {
        min-height: 80px;
    }
    
    .calendar-event {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}

/* Template Management Modal Styles */
#manageTemplatesModal .modal-content {
    max-width: 700px;
}

#manageTemplatesModal .modal-body {
    padding: 24px 30px;
}

#manageTemplatesModal #createTemplateFromManageBtn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    background-color: #667eea;
    color: white;
    transition: all 0.2s ease;
}

#manageTemplatesModal #createTemplateFromManageBtn:hover {
    background-color: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

/* Template Action Buttons */
.template-action-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background-color: #f3f4f6;
    color: #4b5563;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.template-action-btn:hover {
    background-color: #e5e7eb;
    color: #1f2937;
    transform: translateY(-1px);
}

.template-action-btn:active {
    transform: translateY(0);
}

.template-action-btn i {
    font-size: 13px;
}

.template-action-btn-danger {
    background-color: #fee2e2;
    color: #dc2626;
}

.template-action-btn-danger:hover {
    background-color: #fecaca;
    color: #b91c1c;
}

/* Template Item Styles */
.template-item {
    transition: all 0.2s ease;
}

.template-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

#templatesList {
    margin-top: 8px;
}

/* Settings Modal Styles */
.settings-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
    font-size: 1rem;
    color: #000;
}

.settings-menu-item:hover {
    background: #f5f5f5;
    border-color: #ccc;
    transform: translateX(4px);
}

.settings-menu-item i:first-child {
    width: 20px;
    text-align: center;
    color: #667eea;
}

.settings-menu-item span {
    flex: 1;
}

.settings-menu-item i:last-child {
    color: #999;
    font-size: 0.8rem;
}

.settings-menu-item-danger {
    color: #d32f2f;
}

.settings-menu-item-danger:hover {
    background: #ffebee;
    border-color: #d32f2f;
}

.settings-menu-item-danger i:first-child {
    color: #d32f2f;
}

#importStatus {
    background-color: #f5f5f5;
    color: #333;
}

#importStatus.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

#importStatus.error {
    background-color: #ffebee;
    color: #c62828;
}
