:root {
    --bg-color: #FFFFFF;
    --app-bg: #FDFDFD;
    --sidebar-bg: #F8F9FA;
    --text-color: #1C1C1C;
    --text-light: #8A8A8A;
    --border-color: #EAEAEA;
    --accent-yellow: #FFD600;
    --accent-red: #FF4C4C;
    --tag-bg: #f0f1f2;
    --active-item-bg: #F1F2F4;
    --font-family: 'Poppins', sans-serif;
    --border-radius: 8px;
    --transition-speed: 0.3s;
    --gradient-color-1: #7f7fd5;
    --gradient-color-2: #86a8e7;
    --gradient-color-3: #91d1ea;
    --gradient-color-4: #74c0ff;
    --scroll-color: rgb(218, 212, 212);
}


html.dark-mode {
    --bg-color: #121212;
    --app-bg: #1A1A1A;
    --sidebar-bg: #212121;
    --text-color: #E0E0E0;
    --text-light: #9E9E9E;
    --border-color: #3A3A3A;
    --tag-bg: #303030;
    --active-item-bg: #333333;
    --scroll-color: #303030;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    
    margin: auto;
    background-color: var(--app-bg);
    overflow: hidden;
    padding: 10px;
    gap: 10px;
}

.sidebar, .main-content, .task-details {
    background-color: var(--sidebar-bg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: all var(--transition-speed) ease-in-out;
}

.sidebar { width: 280px; flex-shrink: 0; border-radius: var(--border-radius); }
.main-content { flex-grow: 1; }
.task-details { width: 350px; flex-shrink: 0; border-radius: var(--border-radius); }

.task-details.hidden {
    opacity: 0;
    width: 0;
    padding: 0;
    margin-left: -10px;
    border: none;
    pointer-events: none;
}

.sidebar-header { margin-bottom: 24px; }
.menu-title { font-size: 24px; font-weight: 600; }
.search-bar { position: relative; margin-bottom: 24px; }
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); }
.search-bar input { width: 100%; padding: 10px 10px 10px 36px; border: 1px solid var(--border-color); border-radius: var(--border-radius); background-color: var(--bg-color); font-size: 14px; color: var(--text-color); }
.nav-section { margin-bottom: 20px; }
.section-title { font-size: 12px; color: var(--text-light); font-weight: 500; margin-bottom: 12px; text-transform: uppercase; }
.sidebar-nav ul { list-style: none; }
.sidebar-nav li a { display: flex; align-items: center; padding: 10px 12px; text-decoration: none; color: var(--text-color); font-size: 14px; font-weight: 500; border-radius: var(--border-radius); margin-bottom: 4px; transition: background-color 0.2s; }
.sidebar-nav li.active a { background-color: var(--active-item-bg); font-weight: 600; }
.sidebar-nav li a:hover { background-color: var(--active-item-bg); }
.sidebar-nav i { margin-right: 12px; width: 16px; text-align: center; color: var(--text-light); }
.badge { margin-left: auto; background-color: var(--tag-bg); color: var(--text-light); font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.list-color { width: 10px; height: 10px; border-radius: 3px; margin-right: 12px; }
.add-new { color: var(--text-light) !important; text-decoration: none; display: flex; align-items: center; padding: 8px; font-size: 14px; }
#add-new-list-btn { margin-top: 15px; }
.sidebar-footer { margin-top: auto; }
.sidebar-footer a i { margin-right: 8px; }
.sidebar-footer a:hover { background-color: var(--active-item-bg); }

.sidebar-footer a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    border-radius: var(--border-radius);
    margin-bottom: 4px;
    transition: background-color 0.2s;
}

.main-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.main-header h1 { font-size: 32px; font-weight: 700; }
.task-count { background-color: var(--tag-bg); color: var(--text-color); font-weight: 600; padding: 4px 12px; border-radius: var(--border-radius); }
.add-task-bar { display: flex; align-items: center; border: 1px solid var(--border-color); border-radius: var(--border-radius); padding: 12px; margin-bottom: 24px; }
.add-task-bar i { color: var(--text-light); margin-right: 12px; cursor: pointer; }
.add-task-bar input { border: none; outline: none; flex-grow: 1; font-size: 16px; background: transparent; color: var(--text-color); }
#task-list-container { list-style: none; overflow-y: auto; height: 100%; padding-right: 5px; }
.task-item { display: flex; align-items: center; padding: 16px 8px; transition: background-color 0.2s, opacity 0.3s, transform 0.3s; }
.task-item.hidden-search { display: none; }
.task-item.selected { background-color: var(--active-item-bg); }
.task-item:hover { background-color: var(--active-item-bg); }
.task-item.sortable-ghost { opacity: 0.4; background: var(--active-item-bg); }

.task-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-right: 16px;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
    background-color: transparent;
    border: 2px solid var(--text-light); 
}
.task-item input[type="checkbox"]:checked {
    background-color: var(--accent-yellow);
    border-color: var(--accent-yellow);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='20 6 9 17 4 12'%3e%3c/polyline%3e%3c/svg%3e");
    background-size: 80%;
    background-position: center;
    background-repeat: no-repeat;
}

.task-content { flex-grow: 1; margin-right: 16px; }
.task-title { font-size: 16px; }
.task-item.completed .task-title { text-decoration: line-through; color: var(--text-light); }
.task-description-preview { font-size: 13px; color: var(--text-light); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; margin-top: 2px; }

.task-item {
    margin-top: 7px;
    border-radius: 10px;
}
.task-item input {
    margin-left: 10px;
}

.task-details input, .task-details textarea, .task-details select { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: var(--border-radius); background-color: var(--bg-color); font-size: 14px; margin-bottom: 16px; color: var(--text-color); }
.task-details textarea { min-height: 120px; resize: vertical; }
.details-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.pin-icon { font-size: 16px; color: var(--text-light); cursor: pointer; transition: color 0.2s, transform 0.2s; }
.pin-icon.active { color: var(--accent-yellow); transform: scale(1.2); }
.details-actions { margin-top: auto; }
.btn { flex-grow: 1; padding: 12px; border: none; border-radius: var(--border-radius); font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.btn-delete { background-color: transparent; border: 1px solid var(--border-color); color: var(--text-color); }
.btn-delete:hover { background-color: var(--accent-red); color: white; border-color: var(--accent-red); }
.btn-save { background-color: var(--accent-yellow); color: white; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; opacity: 0; transition: opacity var(--transition-speed); pointer-events: none; }
.modal-overlay:not(.hidden) { opacity: 1; pointer-events: all; }
.modal { background-color: var(--sidebar-bg); padding: 24px; border-radius: var(--border-radius); width: 90%; max-width: 400px; transform: scale(0.95); transition: transform var(--transition-speed); }
.modal-overlay:not(.hidden) .modal { transform: scale(1); }
.modal-title { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.color-picker { display: flex; gap: 10px; margin-bottom: 20px; align-items: center; }
.color-swatch { width: 24px; height: 24px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: border-color 0.2s; }
.color-swatch.selected { border-color: var(--text-color); }
input[type="color"] { width: 30px; height: 30px; border: none; padding: 0; border-radius: 50%; cursor: pointer; background-color: transparent; }
.setting-row { display: flex; justify-content: space-between; align-items: center; font-size: 16px; padding: 12px 0; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--accent-yellow); }
input:checked + .slider:before { transform: translateX(22px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }


.list-header {
    position: relative;
    margin-bottom: 24px;
    padding: 20px;
    border-radius: var(--border-radius);
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    overflow: hidden;
}

.list-header-content {
    position: relative;
    z-index: 2;
}

.list-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: white;
}

.list-header p {
    color: white;
}

.list-header p {
    font-size: 14px;
    opacity: 0.9;
    color: white;
}

.list-header-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

#gradient-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.modal-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
    font-size: 14px;
    margin-bottom: 16px;
    color: var(--text-color);
}

.modal textarea {
    min-height: 80px;
    resize: vertical;
}



.main-content {
    position: relative;
}
.main-content {
    position: relative;
    z-index: 2;
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}
.gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-speed) ease-in-out;
}
.main-content-wrapper.gradient-visible .gradient-overlay {
    opacity: 1;
}

.gradient-overlay-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#gradient-canvas-main {
    width: 100%;
    height: 100%;
    position: absolute;
    top: -30%;
    left: 0;
}
.list-header-content h2 {
    z-index: 999;
}

.main-header {
    position: relative;
    z-index: 2;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.main-header h1 {
    color: white;
}

.task-count {
    background-color: var(--tag-bg);
    color: white;
    backdrop-filter: blur(10px);
}

.color-picker {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.color-swatch.selected {
    border-color: var(--text-color);
    transform: scale(1.1);
}

.color-swatch:hover {
    transform: scale(1.05);
}

.custom-color-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
}

.custom-color-input {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 3px solid transparent !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    background: linear-gradient(45deg, #ff0000, #00ff00, #0000ff, #ff0000) !important;
    background-size: 400% 400% !important;
    animation: colorCycle 3s ease-in-out infinite !important;
}

.custom-color-input:hover {
    transform: scale(1.05) !important;
}

.custom-color-input.selected {
    border-color: var(--text-color) !important;
    transform: scale(1.1) !important;
}

@keyframes colorCycle {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.custom-color-input.color-selected {
    animation: none !important;
}
.modal.hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    position: absolute;
}

.main-content-wrapper {
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

.list-header-content {
    color: white;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    padding: 0 0 24px 0;
    position: relative;
    z-index: 2;
}
.list-header-content h2 {
    font-size: 28px;
    font-weight: 700;
}
.list-header-content p {
    font-size: 15px;
    opacity: 0.9;
}
.main-content-wrapper.gradient-visible .main-header h1,
.main-content-wrapper.gradient-visible .task-count {
    color: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

#custom-color-input {
    border-radius: 100%;
}

#input-for-customcolor {
    width: 32px; height: 32px;
    opacity: 0%;
}
#custom-color-input {
    width: 32px;
    height: 32px;
    border-radius: 100%;
    background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
    animation: spin 15s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.context-menu {
    position: absolute;
    z-index: 1001;
    background-color: var(--sidebar-bg);
    border-radius: var(--border-radius);
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    min-width: 150px;
}

.context-menu.hidden {
    display: none;
}

.context-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.context-menu li {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
}

.context-menu li:hover {
    background-color: var(--active-item-bg);
}

.context-menu li i {
    margin-right: 10px;
    color: var(--accent-red);
}

.btn.btn-danger {
    background-color: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}
.btn.btn-danger:hover {
    background-color: #d63838;
}
#custom-alert-cancel-btn {
    justify-content: center;
    text-align: center;
}

#custom-color-input.selected {
    border-color: var(--text-color) !important;
    transform: scale(1.1) !important;
}

.context-menu li i {
    margin-right: 10px;
    width: 16px;
    text-align: center;
}

.context-menu #context-menu-edit i {
    color: var(--accent-yellow);
}

.context-menu #context-menu-delete i {
    color: var(--accent-red);
}

::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

::-webkit-scrollbar-thumb {
  background-color: #1a1a1a;
  border-radius: 6px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-color) var(--sidebar-bg);
}
#login-container.hidden,
#app-wrapper.hidden {
    display: none;
}

#login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
    position: relative;
    overflow: hidden;
}
#gradient-canvas-login {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}



.login-box {
    position: relative;
    z-index: 2;
    background: rgba(248, 249, 250, 0.25); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px;
    border-radius: calc(var(--border-radius) * 2);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    margin-bottom: 24px;
    color: white;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}
.input-group:last-of-type {
    margin-bottom: 40px;
}
.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: white;
}
html.dark-mode .input-group input {
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
}

.input-group input::-webkit-input-placeholder {
    color: white;
    opacity: 0.6;
}
.input-group input::placeholder {
    color: white;
    opacity: 0.6;
}

html.dark-mode .input-group input::placeholder,
html.dark-mode .input-group input::-webkit-input-placeholder {
    color: white;
    opacity: 0.5;
}


.input-group input:focus {
    outline: none;
    border-color: var(--accent-yellow);
    box-shadow: 0 0 0 3px rgba(255, 214, 0, 0.3);
}
.input-group input {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    font-size: 16px;
    color: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.btn-login {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--border-radius);
    background-color: #9B88FF; 
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.btn-login:hover {
    background-color: #8b77f3;
    transform: scale(1.02);
}

.error-message {
    color: var(--accent-red);
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
    display: none;
}

.error-message.active {
    display: block;
}
#login-form input:focus {
    outline: none;
    border-color: rgba(155, 136, 255, 0.3);
    box-shadow: 0 0 0 3px rgba(155, 136, 255, 0.03);
    color: white;
}
/* ZASTĄP CAŁY POPRZEDNI BLOK TYM KODEM */
/* STYLING DLA SEKCJI UKOŃCZONYCH ZADAŃ */
.completed-tasks-container {
    margin-top: 24px;
    /* Usunęliśmy border-top i padding-top */
}

.completed-tasks-header {
    display: inline-flex; /* Kluczowa zmiana: sprawia, że tło jest tylko pod tekstem */
    align-items: center;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--border-radius);
    transition: background-color var(--transition-speed);
    margin-bottom: 8px; /* Odstęp od listy zadań */
}
.completed-tasks-header:hover {
    background-color: var(--active-item-bg);
}

.completed-tasks-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.completed-tasks-header .toggle-icon {
    transition: transform 0.3s ease-in-out;
    color: var(--text-light);
    margin-right: 8px; /* Odstęp między strzałką a tekstem */
}

/* Nowa rotacja dla strzałki w prawo */
.completed-tasks-header .toggle-icon.rotated {
    transform: rotate(90deg);
}

.completed-task-list {
    list-style: none;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, margin-top 0.4s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 1;
}

.completed-task-list.collapsed {
    max-height: 0;
    margin-top: 0 !important;
    opacity: 0;
}





/* --- NOWE STYLE DLA FUNKCJI UDOSTĘPNIANIA --- */

/* Ikona Share w menu kontekstowym */
#context-menu #context-menu-share i {
    color: #4CAFFF; /* Niebieski kolor dla ikony udostępniania */
}

/* Kontener na link w modalu */
#share-link-container {
    margin-bottom: 16px;
}
#share-link-container p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}
#share-link-input {
    width: 100%;
    background-color: var(--bg-color); /* Lepszy kontrast */
    cursor: copy;
}
#share-info-text {
     color: var(--text-light);
}

/* --- STYLE DLA WIDOKU UDOSTĘPNIONEGO --- */
/* ZMIANA: Usunięto .sidebar-footer, .search-bar i .task-item .task-checkbox z listy ukrytych elementów */
body.shared-view .nav-section:first-of-type, /* Ukrywa sekcję TASKS */
body.shared-view #add-new-list-btn,
body.shared-view .add-task-bar,
body.shared-view #task-details-panel,
body.shared-view #context-menu { /* Ukrywa menu kontekstowe */
    display: none !important;
}

/* W widoku udostępnionym zadania nie są klikalne */
body.shared-view .task-item {
    cursor: default;
}
body.shared-view .task-item:hover {
    background-color: transparent;
}

/* W widoku udostępnionym listy nie są klikalne */
body.shared-view .sidebar-nav li a:hover {
    background-color: var(--active-item-bg);
    cursor: default;
}

/* ZMIANA: Checkbox w widoku udostępnionym jest widoczny, ale nieaktywny */
body.shared-view .task-item input[type="checkbox"] {
    cursor: default;
    pointer-events: none;
}