/* Cornell Notes List View Container */
.cornell-container {
    width: 100%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* When editor is open, use editor styles */
.cornell-container:has(.cornell-title-section) {
    width: 100%;
    max-width: 100%;
    margin: 0;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    position: relative;
    font-family: 'Georgia', 'Times New Roman', serif;
    box-sizing: border-box;
}

.cornell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.cornell-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cornell-btn-primary {
    background-color: var(--accent);
    color: white;
}

.cornell-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.cornell-btn-secondary {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.cornell-btn-secondary:hover {
    background-color: var(--nav-active-bg);
}

.cornell-notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.cornell-note-card {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.cornell-note-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.cornell-note-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.cornell-note-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.cornell-note-actions {
    display: flex;
    gap: 8px;
}

.cornell-note-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.cornell-note-action-btn:hover {
    background-color: var(--nav-active-bg);
    color: var(--text-primary);
}

.cornell-note-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.cornell-note-preview {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    white-space: pre-wrap;
}

.cornell-note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.cornell-title-section {
    border-bottom: 3px solid #333;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.cornell-title-input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.8rem;
    font-weight: bold;
    padding: 0.5rem 0;
    text-align: center;
    font-family: inherit;
    background: transparent;
}

.cornell-date-info {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.cornell-date-info input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    color: #666;
}

/* Main content area - contains keynotes and notes columns */
.cornell-content-wrapper {
    display: flex;
    gap: 0;
    min-height: 400px;
    max-height: 500px;
    border-bottom: 3px solid #333;
    margin-bottom: 1.5rem;
    position: relative;
    overflow-y: auto;
}

/* 
KEY ALIGNMENT TECHNIQUE:
- background-size: 100% 1.5rem creates lines spaced 1.5rem apart
- line-height: 1.5rem makes text height match line spacing exactly
- padding-top: 0.25rem offsets text to sit ON the lines (not between)
- This ensures text aligns with lines regardless of screen resolution
*/

/* Keynotes column (left side, 25% width) */
.cornell-keynotes {
    width: 25%;
    padding: 0.25rem 1rem 1rem 0.5rem;
    border-right: 2px solid #999;
    background:
        linear-gradient(transparent 1.4rem, #e3f2fd 1.4rem, #e3f2fd 1.5rem, transparent 1.5rem);
    background-size: 100% 1.5rem;
    line-height: 1.5rem;
    font-size: 0.95rem;
    color: #333;
    outline: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
}

/* Notes column (right side, 75% width) */
.cornell-notes {
    width: 75%;
    padding: 0.25rem 0.5rem 1rem 1rem;
    background:
        linear-gradient(transparent 1.4rem, #ddd 1.4rem, #ddd 1.5rem, transparent 1.5rem);
    background-size: 100% 1.5rem;
    line-height: 1.5rem;
    font-size: 1rem;
    color: #000;
    outline: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
}

/* Summary section at bottom */
.cornell-summary-section {
    margin-top: 1.5rem;
}

.cornell-summary-label {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.cornell-summary {
    width: 100%;
    min-height: 120px;
    padding: 0.25rem 0.5rem 1rem;
    background:
        linear-gradient(transparent 1.4rem, #fff9c4 1.4rem, #fff9c4 1.5rem, transparent 1.5rem);
    background-size: 100% 1.5rem;
    line-height: 1.5rem;
    font-size: 1rem;
    color: #000;
    outline: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Placeholder text styling */
[contenteditable]:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

/* Print styles - ensures clean printing on A4 paper */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .cornell-container {
        max-width: 100%;
        box-shadow: none;
        padding: 1rem;
        page-break-after: avoid;
    }

    /* Maintain line alignment in print */
    .cornell-keynotes,
    .cornell-notes,
    .cornell-summary {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .cornell-container {
        padding: 1.5rem;
    }

    .cornell-title-input {
        font-size: 1.5rem;
    }

    /* 
    Maintain line alignment on mobile:
    - Same background-size and line-height ensure consistency
    - Text remains aligned even when columns stack
    */
    .cornell-content-wrapper {
        flex-direction: column;
    }

    .cornell-keynotes,
    .cornell-notes {
        width: 100%;
        border-right: none;
        border-bottom: 2px solid #999;
    }

    .cornell-notes {
        border-bottom: none;
    }
}

/* Focus styling for better UX */
[contenteditable]:focus {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Cornell Action Button in Tool Header */
.cornell-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 500;
    gap: 6px;
}

.cornell-action-btn:hover {
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.cornell-action-btn:active {
    transform: scale(0.95);
}

.cornell-action-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
    flex-shrink: 0;
}

.cornell-action-btn span {
    white-space: nowrap;
}

/* Cornell Modal Styles */
.cornell-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.cornell-modal {
    background-color: var(--main-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.cornell-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.cornell-modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.cornell-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.cornell-modal-close:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.cornell-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.cornell-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}