* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --accent: #4361ee;
    --accent-hover: #3651d4;
    --success: #06d6a0;
    --danger: #ef476f;
    --warning: #ffd166;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --icon-active: #4361ee;
    --icon-done: #06d6a0;
    --icon-deleted: #ef476f;
    --icon-add: #7209b7;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --border-color: #495057;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --icon-active: #5b7aff;
    --icon-done: #0ef5b8;
    --icon-deleted: #ff6b8f;
    --icon-add: #9d4edd;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}

/* Header */
header {
    background: var(--bg-primary);
    padding: 15px 0;
    box-shadow: var(--card-shadow);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.hamburger-menu {
    background: var(--bg-tertiary);
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 20px;
    transition: all 0.3s;
    display: none;
}

.hamburger-menu:hover {
    background: var(--accent);
    color: white;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 18px;
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--accent);
    color: white;
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 250px;
    background: var(--bg-primary);
    box-shadow: var(--card-shadow);
    padding: 20px 0;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    text-align: left;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
}

.nav-item:hover {
    background: var(--bg-secondary);
}

.nav-item.active {
    background: var(--bg-secondary);
    border-left-color: var(--accent);
}

/* Icon colors */
.nav-item[data-page="active"] i {
    color: var(--icon-active);
}

.nav-item[data-page="done"] i {
    color: var(--icon-done);
}

.nav-item[data-page="deleted"] i {
    color: var(--icon-deleted);
}

.nav-item[data-page="add"] i {
    color: var(--icon-add);
}

/* Main Content */
.main-content {
    margin-left: 250px;
    margin-top: 70px;
    transition: margin-left 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.notification {
    background: linear-gradient(135deg, var(--warning) 0%, #ffb74d 100%);
    color: #000;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    box-shadow: var(--card-shadow);
}

.notification.show {
    display: flex;
}

.notification i {
    font-size: 20px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Form Styles */
.add-task-section {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    max-width: 800px;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.company-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.company-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.company-tag {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s;
    color: var(--text-primary);
    position: relative;
}

.company-tag:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
}

.company-tag .remove-favorite {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.company-tag:hover .remove-favorite {
    display: flex;
}

.btn-add-favorite {
    background: var(--icon-add);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-add-favorite:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(114, 9, 183, 0.3);
}

.color-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-btn,
.color-btn-edit {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}

.color-btn:hover,
.color-btn-edit:hover {
    transform: scale(1.1);
    border-color: var(--text-primary);
}

.color-btn.active,
.color-btn-edit.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.2);
}

input[type="text"],
textarea,
input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border 0.3s;
}

input[type="text"]:focus,
textarea:focus,
input[type="date"]:focus {
    outline: none;
    border-color: var(--accent);
}

#taskTitle {
    font-size: 16px;
    min-height: 50px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input[type="date"] {
    max-width: 200px;
}

.file-input-wrapper {
    position: relative;
    overflow: hidden;
    display: inline-block;
}

.file-input-label {
    background: var(--bg-tertiary);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    color: var(--text-primary);
}

.file-input-label:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.file-input-label.uploaded {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-name {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

/* Task Cards */
.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.task-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    transition: all 0.3s;
    border: 2px solid transparent;
    cursor: pointer;
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: var(--accent);
}

.task-card.done-card {
    border-color: var(--success);
}

.task-card.done-card:hover {
    border-color: var(--success);
}

.task-company {
    display: inline-block;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.task-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-description {
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.task-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.task-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
}

.task-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.task-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: var(--bg-tertiary);
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
}

.icon-btn:hover {
    transform: scale(1.1);
}

.icon-btn.edit:hover {
    background: var(--accent);
    color: white;
}

.icon-btn.delete:hover {
    background: var(--danger);
    color: white;
}

.icon-btn.restore:hover {
    background: var(--success);
    color: white;
}

.icon-btn.permanent-delete:hover {
    background: #c0392b;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close:hover {
    color: var(--danger);
}

.view-detail-group {
    margin-bottom: 20px;
}

.view-detail-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.view-detail-group p {
    color: var(--text-secondary);
    line-height: 1.8;
    word-wrap: break-word;
}

.view-detail-group img {
    width: 100%;
    border-radius: 8px;
    margin-top: 10px;
}

/* Confirmation Modal */
.confirm-modal {
    text-align: center;
    max-width: 450px;
}

.confirm-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.confirm-icon i {
    font-size: 40px;
    color: white;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 71, 111, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(239, 71, 111, 0);
    }
}

.confirm-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.confirm-message {
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.6;
    font-size: 15px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-cancel:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef476f 0%, #d63a5a 100%);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 71, 111, 0.4);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 20px;
    }

    .hamburger-menu {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .container {
        padding: 15px;
        width: 100%;
    }

    .add-task-section {
        padding: 20px;
        width: 100%;
    }

    .tasks-grid {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .company-header {
        gap: 6px;
        width: 100%;
    }

    .company-tag {
        font-size: 12px;
        padding: 5px 12px;
    }

    .notification {
        font-size: 14px;
        padding: 12px 16px;
    }

    .modal-content {
        padding: 20px;
        width: 95%;
        max-width: 95%;
    }

    .header-content {
        padding: 0 15px;
    }

    .task-card {
        width: 100%;
    }

    .confirm-actions {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-danger {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 18px;
    }

    .section-title {
        font-size: 18px;
    }

    .task-card {
        padding: 15px;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .company-header {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-add-favorite {
        width: 100%;
        justify-content: center;
    }

    .color-options {
        justify-content: center;
    }

    input[type="date"] {
        max-width: 100%;
    }
}