/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8fafc;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 1.8rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #10b981;
    color: white;
}

.btn-secondary:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}

/* Main Content */
.main {
    flex: 1;
    padding: 2rem 0;
}

/* Quick Add Section */
.quick-add-section {
    margin-bottom: 2rem;
}

.quick-add-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.quick-add-card h3 {
    color: #374151;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-add-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.form-row input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.form-row input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Calendar Section */
.calendar-section {
    margin-top: 2rem;
}

.calendar-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    text-align: center;
}

.calendar-card h3 {
    color: #374151;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.calendar-card p {
    color: #6b7280;
    margin-bottom: 1rem;
}

/* Filters */
.filters {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.filters {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .filters {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        align-items: end;
    }
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    background: white;
    color: #6b7280;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
}

.filter-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.filter-btn.selected {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* Items Grid */
.items-section {
    margin-bottom: 2rem;
}

.items-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 0.5rem;
    }
}

@media (min-width: 1024px) {
    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* Item Card */
.item-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.item-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.item-card.completed {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.item-card.completed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #10b981;
}

.item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.item-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.date {
    font-size: 0.75rem;
    color: #6b7280;
    white-space: nowrap;
}

.tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.tag {
    background: #f3f4f6;
    color: #374151;
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    white-space: nowrap;
}

.tag.untagged {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.completion-badge {
    background: #ecfdf5;
    color: #065f46;
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 500;
    border: 1px solid #bbf7d0;
    white-space: nowrap;
}

.actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-action {
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    font-size: 0.8rem;
}

.btn-action:hover {
    background: #f3f4f6;
    color: #374151;
}

.btn-action.complete {
    color: #10b981;
}

.btn-action.complete:hover {
    background: #ecfdf5;
}

.btn-action.edit {
    color: #3b82f6;
}

.btn-action.edit:hover {
    background: #eff6ff;
}

.btn-action.delete {
    color: #ef4444;
}

.btn-action.delete:hover {
    background: #fef2f2;
}

.btn-action.uncomplete {
    color: #f59e0b;
}

.btn-action.uncomplete:hover {
    background: #fef3c7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    color: #111827;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Form */
#itemForm {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tag Selector */
.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 2.5rem;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
}

.tag-selector.empty {
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-style: italic;
}

.tag-selector .tag-option {
    background: white;
    color: #374151;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.tag-selector .tag-option:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.tag-selector .tag-option.selected {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.add-tag-section {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.add-tag-section input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

/* Tag Management */
.tag-management-content {
    padding: 1.5rem;
}

.existing-tags h4 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.existing-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.existing-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.existing-tag .delete-tag {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.existing-tag .delete-tag:hover {
    background: #fef2f2;
}

/* Tag Delete Confirmation */
.tag-delete-confirmation {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.tag-delete-confirmation .confirm-delete,
.tag-delete-confirmation .cancel-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.tag-delete-confirmation .confirm-delete {
    color: #10b981;
}

.tag-delete-confirmation .confirm-delete:hover {
    background: #ecfdf5;
}

.tag-delete-confirmation .cancel-delete {
    color: #6b7280;
}

.tag-delete-confirmation .cancel-delete:hover {
    background: #f3f4f6;
}

/* Confirmation Modal */
.confirm-content {
    padding: 1.5rem;
}

.confirm-content p {
    color: #374151;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Completion Modal */
.completion-content {
    padding: 1.5rem;
}

/* Edit Task Modal */
.edit-task-content {
    padding: 1.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Calendar Modal */
.calendar-content {
    padding: 1.5rem;
}

.calendar-url {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.calendar-url input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #f9fafb;
}

.instructions {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.instructions h4 {
    color: #374151;
    margin-bottom: 0.75rem;
}

.instructions ol {
    color: #6b7280;
    padding-left: 1.25rem;
}

.instructions li {
    margin-bottom: 0.5rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #111827;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1001;
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #d1d5db;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: #374151;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

.loading i {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Hide calendar button */
#calendarBtn {
    display: none;
}

/* User info display */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.9rem;
    margin-right: 1rem;
}

.user-info i {
    color: #9ca3af;
}

.user-info span {
    font-weight: 500;
}

/* Voting system */
.voting-section {
    display: flex;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.vote-btn {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.vote-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.vote-btn.up-vote.active {
    background: #ecfdf5;
    border-color: #10b981;
    color: #10b981;
}



.vote-btn i {
    font-size: 0.7rem;
}

.vote-count {
    font-weight: 500;
    min-width: 1rem;
    text-align: center;
}

.voting-section {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* Responsive Design */
@media (max-width: 640px) {
    .header .container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .logo {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    .main {
        padding: 1rem 0;
    }

    .quick-add-card,
    .calendar-card,
    .filters {
        padding: 1rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-row input {
        width: 100%;
    }

    .form-row .btn {
        width: 100%;
    }

    .item-card {
        padding: 0.375rem;
    }

    .item-title {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    .item-card {
        padding: 0.375rem;
    }

    .item-title {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }

    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
        transform: translateY(100%);
    }

    .toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .item-card {
        padding: 0.25rem;
    }

    .item-title {
        font-size: 0.8rem;
        margin-bottom: 0.15rem;
    }
}