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

:root {
    --primary-color: #4A90E2;
    --secondary-color: #357ABD;
    --background: #e8eaed;
    --column-bg: #f7f8fa;
    --card-bg: #ffffff;
    --border-color: #dfe1e6;
    --text-primary: #172b4d;
    --text-secondary: #5e6c84;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --danger-bg-hover: #ffe5e5;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
    --header-bg: #ffffff;
    --modal-bg: #ffffff;
    --btn-secondary-bg: #e4e6eb;
    --btn-secondary-text: #172b4d;
    --btn-secondary-hover: #d4d6db;
}

/* Dark mode */
[data-theme="dark"] {
    --primary-color: #5A9FE8;
    --secondary-color: #4A8FD8;
    --background: #1a1a2e;
    --column-bg: #16213e;
    --card-bg: #1f2940;
    --border-color: #3a4a5e;
    --text-primary: #e4e6eb;
    --text-secondary: #a8b3c5;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --danger-bg-hover: #3d2020;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.4);
    --header-bg: #16213e;
    --modal-bg: #1f2940;
    --btn-secondary-bg: #4a5568;
    --btn-secondary-text: #e4e6eb;
    --btn-secondary-hover: #5a6578;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--header-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

/* List title and selector styles */
.list-title-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.list-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    margin: 0;
    transition: background-color 0.2s;
}

.list-title:hover {
    background-color: var(--background);
}

.list-selector-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.list-selector-btn:hover {
    background-color: var(--background);
    color: var(--text-primary);
}

.list-selector-btn .material-icons {
    font-size: 24px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
}

.btn-secondary {
    background-color: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
}

.btn-secondary:hover {
    background-color: var(--btn-secondary-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.column {
    min-width: 300px;
    background-color: var(--column-bg);
    border-radius: 8px;
    padding: 15px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 220px);
    cursor: grab;
    transition: opacity 0.2s, box-shadow 0.2s;
}

.column:active {
    cursor: grabbing;
}

.column.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .column {
        height: calc(100vh - 180px);
        min-height: 400px;
    }
}

.column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    gap: 8px;
}

.column-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
}

.column-title:hover {
    background-color: var(--background);
}

.column-actions {
    display: flex;
    gap: 5px;
}

.column-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    color: var(--text-secondary);
    line-height: 1;
    transition: background-color 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collapse-btn .material-icons {
    font-size: 18px;
}

.collapse-btn:hover {
    background-color: var(--background);
    color: var(--text-primary);
}

.card-count {
    background-color: var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Collapsed column styles for scroll mode */
.column.collapsed {
    min-width: 60px;
    width: 60px;
    padding: 15px 10px;
}

.column.collapsed .column-header {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.column.collapsed .column-header-left {
    flex-direction: column;
    gap: 8px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
}

.column.collapsed .column-title {
    font-size: 14px;
    padding: 5px 2px;
}

.column.collapsed .card-count {
    writing-mode: horizontal-tb;
}

.column.collapsed .column-actions {
    display: none;
}

.column.collapsed .cards {
    display: none;
}

.column.collapsed .add-card-btn {
    display: none;
}

/* Collapsed column styles for stacked mode */
.board.stacked .column.collapsed {
    min-width: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    padding: 15px;
}

.board.stacked .column.collapsed .column-header {
    flex-direction: row;
    gap: 0;
}

.board.stacked .column.collapsed .column-header-left {
    flex-direction: row;
    writing-mode: horizontal-tb;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 18px;
}

.icon-btn:hover {
    background-color: var(--background);
    color: var(--text-primary);
}

/* Dropdown menu styles */
.menu-container {
    position: relative;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 3px;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1;
}

.menu-btn .material-icons {
    font-size: 18px;
}

.menu-btn:hover {
    background-color: var(--background);
    color: var(--text-primary);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    z-index: 100;
    margin-top: 5px;
}

.dropdown-menu.active {
    display: block;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.menu-item .material-icons {
    font-size: 18px;
    color: var(--text-secondary);
}

.menu-item:first-child {
    border-radius: 5px 5px 0 0;
}

.menu-item:last-child {
    border-radius: 0 0 5px 5px;
}

.menu-item:hover {
    background-color: var(--background);
}

.menu-item.danger {
    color: var(--danger-color);
}

.menu-item.danger:hover {
    background-color: var(--danger-bg-hover);
}

/* Add column icon button */
.add-column-icon-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.add-column-icon-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.add-column-icon-btn .material-icons {
    font-size: 20px;
}

/* Add card icon button in column header */
.add-card-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.add-card-icon-btn:hover {
    background-color: var(--background);
    color: var(--text-primary);
}

.add-card-icon-btn .material-icons {
    font-size: 20px;
}

/* View toggle button group */
.view-toggle-group {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}

.view-toggle-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.view-toggle-btn:first-child {
    border-right: 1px solid var(--border-color);
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

.view-toggle-btn .material-icons {
    font-size: 18px;
}

/* Stacked view mode */
.board.stacked {
    flex-direction: column;
    overflow-x: visible;
}

.board.stacked .column {
    min-width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
}

.board.stacked .cards {
    overflow-y: visible;
    max-height: none;
}

.cards {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 8px 10px;
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: grab;
    transition: box-shadow 0.2s, border-color 0.2s;
    max-width: 400px;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.card-title {
    font-size: 14px;
    font-weight: 500;
    word-wrap: break-word;
    margin-bottom: 4px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.card-link-icon {
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.card-link-icon .material-icons {
    font-size: 18px;
}

.card-link-icon:hover {
    background-color: var(--background);
}

.card-link-placeholder {
    width: 22px;
}

.add-card-btn {
    width: 100%;
    padding: 8px;
    background-color: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 5px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.add-card-btn:hover {
    background-color: var(--background);
    border-color: var(--text-secondary);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--modal-bg);
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.editable-input {
    width: 100%;
    padding: 5px;
    border: 2px solid var(--primary-color);
    border-radius: 3px;
    font-size: 16px;
    font-weight: 600;
}

.editable-input:focus {
    outline: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
    }
    
    .column {
        min-width: 250px;
    }
}

/* Settings menu */
.settings-menu-container {
    position: relative;
}

.settings-menu-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.settings-menu-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.settings-menu-btn .material-icons {
    font-size: 20px;
}

.settings-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 100;
    margin-top: 5px;
}

.settings-dropdown-menu.active {
    display: block;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.settings-menu-item:first-child {
    border-radius: 5px 5px 0 0;
}

.settings-menu-item:last-child {
    border-radius: 0 0 5px 5px;
}

.settings-menu-item:hover {
    background-color: var(--background);
}

.settings-menu-item .material-icons {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Theme toggle button */
.theme-toggle-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle-btn .material-icons {
    font-size: 22px;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: all 0.2s;
}

.theme-toggle-btn:hover .material-icons {
    opacity: 1;
}

/* Dark mode: icon is white */
[data-theme="dark"] .theme-toggle-btn .material-icons {
    color: #ffffff;
    opacity: 1;
}

/* List selector modal styles */
.list-selector-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.list-selector-modal.active {
    display: flex;
}

.list-selector-content {
    background-color: var(--modal-bg);
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.list-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.list-add-btn {
    width: 28px;
    height: 28px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.list-add-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.list-add-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3);
}

.list-add-btn .material-icons {
    font-size: 18px;
}

.list-items {
    max-height: 50vh;
    overflow-y: auto;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.list-item:hover {
    background-color: var(--background);
}

.list-item.active {
    background-color: var(--primary-color);
    color: white;
}

.list-item-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.list-item-delete {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.6;
}

.list-item-delete:hover {
    background-color: var(--danger-bg-hover);
    color: var(--danger-color);
    opacity: 1;
}

.list-item.active .list-item-delete {
    color: white;
}

.list-item.active .list-item-delete:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.list-item-delete .material-icons {
    font-size: 18px;
}

/* Editable list title input */
.list-title-input {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 5px;
    padding: 5px 10px;
    outline: none;
    font-family: inherit;
}

/* Share modal styles */
.share-modal-content {
    background-color: var(--modal-bg);
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.share-url-preview {
    width: 100%;
    padding: 12px;
    background-color: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 12px;
    font-family: monospace;
    word-break: break-all;
    max-height: 100px;
    overflow-y: auto;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.share-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.share-actions .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-actions .btn .material-icons {
    font-size: 18px;
}

/* Edit shared list button */
.edit-shared-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.edit-shared-btn:hover {
    background-color: var(--secondary-color);
}

.edit-shared-btn .material-icons {
    font-size: 18px;
}

/* View-only mode indicator */
.view-only-banner {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

/* Disable interactions in view-only mode */
.view-only .card {
    cursor: default;
}

.view-only .card:hover {
    border-color: var(--border-color);
}

.view-only .column {
    cursor: default;
}

.view-only .add-card-btn,
.view-only .add-card-icon-btn,
.view-only .column-menu-btn,
.view-only .card-menu-btn,
.view-only .list-title,
.view-only .column-title,
.view-only .list-selector-btn,
.view-only #settingsAddListBtn,
.view-only #settingsAddColumnBtn,
.view-only #settingsShareListBtn {
    pointer-events: none;
    opacity: 0.5;
}
