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

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

main {
    flex: 1;
}

.pattern {
    display: flex;
    flex-direction: column;
    flex: 1;
}

header {
    background: #2d3e50;
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

footer {
    background: #2d3e50;
    color: white;
    text-align: center;
    padding: 15px 20px;
    width: 100%;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    margin-top: auto;
}

.container {
    display: flex;
    /* Use min-height so content can extend and page can scroll */
    min-height: 100vh;
    width: 100%;
}

/* Section principale gauche */
.main-section {
    flex: 1;
    min-height: 100vh;
    height: auto;
    display: flex;
    flex-direction: column;
    background: white;
    border-right: 2px solid #e0e0e0;
}

/* Onglets */
.tabs {
    display: flex;
    background: #fafafa;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 20px;
}

.tab {
    padding: 15px 25px;
    cursor: pointer;
    border: none;
    background: transparent;
    font-size: 16px;
    font-weight: auto;
    position: relative;
    color: #666;
}

.tab.active {
    color: #333;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #333;
}

.tab-close {
    margin-left: 10px;
    color: #999;
    font-weight: bold;
}

.tab-add {
    margin-left: auto;
    font-size: 20px;
    color: #666;
}

/* Contenu des sections */
.content {
    flex: 1;
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
    padding: 30px;
}

.category {
    margin-bottom: 40px;
    transition: transform 0.25s, opacity 0.25s;
}

/* Header layout and delete button */
.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.category-header h2 { margin: 0; }

.category-delete {
    background: transparent;
   
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px 8px;
}
.category-delete:hover {
    background: #ffebee;
    border-radius: 6px;
    
}

/* Animation for adding/removing category */
.category-add {
    animation: categoryEnter .35s ease forwards;
    transform-origin: top;
}
@keyframes categoryEnter {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.category-removing {
    animation: categoryExit .2s ease forwards;
}
@keyframes categoryExit {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

.category-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
    border: none;
    list-style: none;
}

.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.task-item:hover {
    background: #fafafa;
    padding-left: 10px;
    margin-left: -10px;
}

/* Animation de suppression pour les tâches */
.task-removing {
    animation: taskExit .18s ease forwards;
    will-change: opacity, transform;
}
@keyframes taskExit {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.task-checkbox.checked {
    background: #4CAF50;
    border-color: #4CAF50;
    position: relative;
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
}

.task-text {
    flex: 1;
    color: #333;
    border: none;
    background: transparent;
    font-size: 16px;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.task-text:focus {
    outline: none;
    background: #f0f0f0;
}

.task-text.completed {
    text-decoration: line-through;
    color: #999;
}

.task-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    ;
    
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    background: #ffebee;
    border-radius: 4px;
}

.add-task-btn {
    margin-top: 10px;
    padding: 10px 15px;
    background: #f5f5f5;
    border: 1px dashed #ccc;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    width: 100%;
    transition: all 0.2s;
}

.add-task-btn:hover {
    background: #e8e8e8;
    border-color: #999;
    color: #333;
}
.save-container {
    position: relative;
    bottom: 20px;
    width: calc(100% - 35px);
    background: white;
    padding: 10px 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.save-btn {
    position: relative;
    top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 12px 20px;
    background: #2d3e50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 1500;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

.save-btn:hover {
    background: #1a2635;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.save-btn:active {
    transform: scale(0.98);
}
.add-category-btn {
    margin-top: 10px;
    padding: 10px 15px;
    background: #f5f5f5;
    border: 1px dashed #ccc;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    width: 100%;
    transition: all 0.2s;
}

/* Panneau latéral droit */
.sidebar {
    width: 350px;
    background: white;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e0e0e0;
    padding-bottom: 80px;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 2px solid #e0e0e0;
    background: #fafafa;
}

.pattern-list {
    list-style: none;
    padding: 10px;
}

.pattern-item {
    padding: 12px 15px;
    margin: 5px 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.pattern-item:hover {
    background: #e8e8e8;
}

.pattern-text {
    position: relative;
    flex: 1;
    font-size: 16px;
    color: #333;
    border: none;
    background: transparent;
    cursor: text;
}

.pattern-edit-input {
    width: calc(100% - 48px);
    font-size: inherit;
    color: #e8e8e8;
    border: none;
    padding: 6px 8px;
    background: transparent;
    border-radius: 6px;
    cursor: text;
    transition: background 0.2s;

}

.pattern-edit-input:focus {
  outline: none;
  background: #2d3e50;
}

.pattern-item.active {
    background: #e3f2fd;
    border-left: 3px solid #2d3e50;
}

.add-pattern-btn {
    margin: 10px;
    padding: 12px;
    background: #2d3e50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    bottom: 10px;
    z-index: 100;
}

.add-pattern-btn:hover {
    background: #2d3e50;
}
.pattern-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18x;
    padding: 4px 8px;
    ;
    
}
.pattern-item:hover .pattern-delete {
    opacity: 1;
}

.pattern-delete:hover {
    background: #ffebee;
    border-radius: 40px;
}

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

.modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    animation: modalSlideIn 0.3s ease;
}

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

.modal > h3 {
    padding: 24px 24px 0;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #2d3e50;
    text-align: center;
}

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

.modal-existing,
.modal-new {
    margin-bottom: 24px;
}

.modal-existing:last-child,
.modal-new:last-child {
    margin-bottom: 0;
}

.modal-existing > label,
.modal-new > label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-pattern-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
}

.modal-pattern-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    position: relative;
}

.modal-pattern-item:last-child {
    border-bottom: none;
}

.modal-pattern-item:hover {
    background: #e8e8e8;
    padding-left: 20px;
}

.modal-pattern-item.selected {
    background: #e3f2fd;
    color: #2d3e50;
    font-weight: 600;
    padding-left: 16px;
}

.modal-pattern-item.selected::before {
    content: '✓';
    position: absolute;
    left: 8px;
    color: #2d3e50;
    font-weight: bold;
    font-size: 16px;
}

.modal-new-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
    color: #333;
}

.modal-new-input:focus {
    outline: none;
    border-color: #2d3e50;
    background: #f9f9f9;
    box-shadow: 0 0 0 3px rgba(45, 62, 80, 0.1);
}

.modal-new-input::placeholder {
    color: #999;
}

.modal-actions {
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 0 0 16px 16px;
    justify-content: flex-end;
}

.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-cancel {
    background: #e0e0e0;
    color: #333;
}

.modal-cancel:hover {
    background: #d0d0d0;
}

.modal-select,
.modal-create {
    background: #2d3e50;
    color: white;
}

.modal-select:hover,
.modal-create:hover {
    background: #1a2635;
    box-shadow: 0 4px 12px rgba(45, 62, 80, 0.3);
}

.modal-select:active,
.modal-create:active {
    transform: scale(0.98);
}

/* Responsive */
@media (max-width: 968px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 40vh;
    }

    .markdown-section {
        border-top: none;
        border-left: none;
    }
}

@media (max-width: 640px) {
    .content {
        padding: 15px;
    }

    .tabs {
        padding: 0 10px;
        overflow-x: auto;
    }

    .tab {
        padding: 12px 15px;
        font-size: 14px;
    }

    .category-title {
        font-size: 20px;
    }
}
/* Login Page Styles */
.login-box {
    width: 300px;
    margin: 100px auto;
    padding: 20px;
    border: 5px solid #7a5a2f;
    border-radius: 10px;
    background-color: #f9f9f9;

    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.input-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #aaa;
    border-radius: 5px;
}

button {
    width: 100%;
    padding: 10px;
    border: none;
    background-color: #2d3e50;
    color: white;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background-color: #555;
}
.creating-account-box {
    width: 300px;
    margin: 100px auto;
    padding: 20px;
    border: 5px solid #7a5a2f;
    border-radius: 10px;
    background-color: #f9f9f9;

    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.create-account-link {
    margin-bottom: 5px;
}
.create-account-link a {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.creating-account-box h2 {
    text-align: center;
    margin-bottom: 20px;
}
.create-account-link {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
}
.main-content {
  background: rgba(20, 15, 8, 0.97);
  border-radius: 18px;
  box-shadow: 0 0 32px 10px #000c, 0 0 0 8px #18120c inset;
  border: 8px solid #7a5a2f;
  border-image: url('https://i.imgur.com/6QKQ4Qp.png') 30 round;
  font-size: 1.25em;
  color: #3a2d1a;
  position: relative;
}
