:root {
    --bg-primary: #0e1111;
    --bg-secondary: #161a1d;
    --bg-card: #1b2024;
    --bg-card-hover: #22282d;
    --accent-purple: #8b5cf6;
    --accent-blue: #0ea5e9;
    --accent-green: #10b981;
    --accent-cyan: #06b6d4;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --text-main: #f1f5f9;
    --text-muted: #8b949e;
    --border-color: #272f36;
    --border-radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* HEADER */
header {
    background: rgba(14, 17, 17, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-img {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
}

.brand-logo-img:hover {
    transform: scale(1.05);
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.brand-text h1 {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.brand-text p {
    font-size: 11px;
    color: var(--text-muted);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(22, 26, 29, 0.8);
    padding: 6px 16px;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 180px;
}

.progress-bar-bg {
    flex: 1;
    height: 8px;
    background: #272f36;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    width: 0%;
    transition: width 0.4s ease;
}

.progress-percent {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-green);
    min-width: 90px;
}

.controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    position: relative;
}

.search-box input {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 12px 8px 34px;
    border-radius: 8px;
    color: #fff;
    font-size: 12px;
    width: 200px;
    outline: none;
    transition: all 0.2s;
}

.search-box input:focus {
    border-color: var(--accent-purple);
    width: 240px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
}

.btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), #7c3aed);
    border: none;
    color: #fff;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
    background: rgba(39, 47, 54, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.btn-danger:hover {
    background: var(--accent-red);
    color: #fff;
}

.sync-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

/* CATEGORIES BAR */
.category-bar-wrapper {
    background: rgba(22, 26, 29, 0.6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 24px;
    gap: 12px;
}

.category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.cat-tab {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cat-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.cat-tab.active {
    color: #fff;
    background: var(--accent-purple);
    border-color: var(--accent-purple);
}

.cat-manage-btn {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.1);
    border: 1px dashed rgba(6, 182, 212, 0.4);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.cat-manage-btn:hover {
    background: rgba(6, 182, 212, 0.2);
}

/* KANBAN BOARD */
.kanban-board {
    flex: 1;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(5, minmax(290px, 1fr));
    gap: 16px;
    overflow-x: auto;
    align-items: start;
}

.column {
    background: rgba(22, 26, 29, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 175px);
}

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

.column-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
}

.col-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.col-todo .col-indicator { background: var(--accent-yellow); }
.col-doing .col-indicator { background: var(--accent-blue); }
.col-done .col-indicator { background: var(--accent-green); }
.col-verified .col-indicator { background: var(--accent-cyan); }
.col-cancel .col-indicator { background: var(--accent-red); }

.count-badge {
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 12px;
    font-weight: 600;
}

.task-list {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
}

.task-list.drag-over {
    background: rgba(139, 92, 246, 0.08);
    border-radius: 8px;
}

/* CARD STYLE */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.task-card:hover {
    border-color: rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.task-card.dragging {
    opacity: 0.4;
}

.card-category {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-bottom: 6px;
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 5px;
    color: var(--text-main);
}

.card-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.card-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-img {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.badge-notes {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-time {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
}

.card-actions {
    display: flex;
    gap: 6px;
}

.card-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.card-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.card-btn.delete:hover {
    color: var(--accent-red);
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 650px;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

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

.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--accent-purple);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

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

/* FORMAT TOOLBAR & RICH TEXT */
.rich-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.toolbar-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
}

.toolbar-btn:hover {
    color: #fff;
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-purple);
}

.rich-content {
    line-height: 1.6;
    word-break: break-word;
}

.rich-content ul, .rich-content ol {
    margin-left: 20px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.rich-content li {
    margin-bottom: 4px;
}

.rich-content strong {
    color: #fff;
    font-weight: 600;
}

.rich-content code {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: #38bdf8;
}

.rich-content pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: monospace;
    font-size: 11px;
    border: 1px solid var(--border-color);
}

/* TIMELINE & NOTES */
.timeline-box {
    background: rgba(14, 17, 17, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px;
    font-size: 11px;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-label {
    color: var(--text-muted);
    font-size: 10px;
}

.timeline-val {
    font-weight: 600;
    color: var(--text-main);
}

.notes-section {
    margin-top: 18px;
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.note-item {
    background: rgba(27, 32, 36, 0.9);
    border-left: 3px solid var(--accent-purple);
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    font-size: 12px;
}

.note-meta {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.note-text {
    color: var(--text-main);
    line-height: 1.4;
    word-break: break-word;
}

.add-note-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.add-note-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.add-note-row textarea {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text-main);
    font-size: 13px;
    line-height: 1.5;
    outline: none;
    min-height: 72px;
    max-height: 280px;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
    font-family: inherit;
}

.add-note-row textarea:focus {
    border-color: var(--accent-purple);
}

.add-note-row button {
    background: var(--accent-purple);
    border: none;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-end;
    height: fit-content;
    white-space: nowrap;
    transition: background 0.15s;
}

.add-note-row button:hover {
    background: #9d6fff;
}

/* IMAGES & LIGHTBOX */
.preview-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.preview-img-card {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #000;
    cursor: zoom-in;
}

.preview-img-card img {
    width: 100%;
    height: 140px;
    object-fit: contain;
    display: block;
}

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.lightbox-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

/* CATEGORY MANAGER MODAL */
.cat-list-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.cat-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
}

.cat-item-name {
    font-size: 12px;
    font-weight: 500;
}

.cat-item-actions {
    display: flex;
    gap: 6px;
}

/* IMAGE UPLOADER & THUMBNAILS */
.image-upload-box {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    background: rgba(14, 17, 17, 0.5);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 10px;
}

.image-upload-box:hover, .image-upload-box.drag-over {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.08);
}

.image-upload-box i {
    font-size: 24px;
    color: var(--accent-purple);
    margin-bottom: 6px;
    display: block;
}

.image-upload-box p {
    font-size: 12px;
    color: var(--text-muted);
}

.image-upload-box span {
    font-size: 10px;
    color: var(--accent-cyan);
    font-weight: 600;
}

.uploaded-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.uploaded-thumb-card {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #000;
    height: 70px;
}

.uploaded-thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.thumb-delete-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(239, 68, 68, 0.85);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.thumb-delete-btn:hover {
    background: var(--accent-red);
}

/* CUSTOM DELETE CONFIRMATION MODAL */
.delete-modal-box {
    max-width: 440px;
    text-align: center;
    padding: 30px 24px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(239, 68, 68, 0.15);
}

.delete-modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
}

.delete-modal-icon i {
    font-size: 26px;
    color: var(--accent-red);
}

.delete-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.delete-modal-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
    word-break: break-word;
}

.delete-modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.delete-modal-actions button {
    flex: 1;
    max-width: 160px;
    justify-content: center;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
}

/* MOBILE RESPONSIVE */
.mobile-nav-bar {
    display: none;
}

@media (max-width: 850px) {
    header {
        padding: 12px 16px;
        gap: 10px;
    }

    .header-stats {
        width: 100%;
        justify-content: space-between;
        order: 3;
    }

    .progress-container {
        width: 160px;
    }

    .controls {
        order: 2;
    }

    .search-box input {
        width: 140px;
    }

    .search-box input:focus {
        width: 170px;
    }

    .category-bar-wrapper {
        padding: 8px 16px;
    }

    /* Mobile Horizontal Snap Columns */
    .kanban-board {
        padding: 12px 16px;
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 12px;
    }

    .column {
        min-width: 86vw;
        max-width: 86vw;
        scroll-snap-align: center;
        max-height: calc(100vh - 215px);
    }

    /* Mobile Bottom Sheet Style for Modals */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        padding: 20px 16px;
    }

    /* Mobile Column Switch Bar */
    .mobile-nav-bar {
        display: flex;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        padding: 6px 12px;
        position: sticky;
        bottom: 0;
        z-index: 100;
        overflow-x: auto;
        gap: 6px;
        scrollbar-width: none;
    }

    .mobile-nav-btn {
        flex: 1;
        min-width: 70px;
        padding: 6px 8px;
        font-size: 10px;
        font-weight: 600;
        border-radius: 6px;
        background: transparent;
        border: 1px solid var(--border-color);
        color: var(--text-muted);
        text-align: center;
        cursor: pointer;
        white-space: nowrap;
    }

    .mobile-nav-btn.active {
        background: var(--accent-purple);
        color: #fff;
        border-color: var(--accent-purple);
    }
}
