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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    padding: 20px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 600px;
    width: 100%;
    height: calc(100vh - 40px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px 20px 30px;
    position: relative;
}

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

.header-text {
    text-align: center;
    flex: 1;
}

.header-text h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.header-text h1 i {
    margin-right: 15px;
}

.header-text p {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 300;
    margin-bottom: 15px;
}

.settings-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.todo-input-container {
    padding: 30px;
    border-bottom: 1px solid #f0f0f0;
}

.input-wrapper {
    display: flex;
    gap: 15px;
    align-items: center;
}

#todoInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: #fafafa;
}

#todoInput:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
}

#addBtn,
.ai-btn {
    padding: 15px 20px;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    min-width: 60px;
}

#addBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#addBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.ai-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    position: relative;
}

.ai-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.ai-btn:disabled {
    background: linear-gradient(135deg, #ccc 0%, #999 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-btn::after {
    content: "Coming Soon";
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ai-btn:hover::after {
    opacity: 1;
}

.filter-tabs {
    display: flex;
    padding: 0;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.filter-buttons {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.filter-btn.active,
.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.todo-stats {
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
    font-size: 0.9rem;
    color: #666;
}

.todo-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #f0f0f0;
    background: white;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

.todo-item:hover {
    background: #f8f9fa;
}

.todo-item.completed {
    opacity: 0.6;
}

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

.todo-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.todo-checkbox.completed {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.todo-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.todo-text {
    font-size: 1.1rem;
    word-break: break-word;
}

.todo-deadline {
    font-size: 0.85rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #666;
}

.todo-deadline i {
    font-size: 0.8rem;
}

.deadline-overdue {
    color: #dc3545;
    font-weight: 600;
}

.deadline-today {
    color: #fd7e14;
    font-weight: 600;
}

.deadline-tomorrow {
    color: #ffc107;
    font-weight: 500;
}

.deadline-this-week {
    color: #20c997;
    font-weight: 400;
}

.deadline-later {
    color: #6c757d;
    font-weight: 400;
}

.todo-actions {
    display: flex;
    gap: 10px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.edit-btn,
.delete-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 40px;
    min-height: 32px;
    justify-content: center;
}

.btn-text {
    display: none;
    font-size: 0.85rem;
}

/* Show text fallback if icons don't load or on very small screens */
@media (max-width: 480px) {
    .btn-text {
        display: inline;
    }
    .edit-btn i,
    .delete-btn i {
        display: none;
    }
}

.edit-btn {
    background: #2196F3;
    color: white;
}

.edit-btn:hover {
    background: #1976D2;
}

.delete-btn {
    background: #f44336;
    color: white;
}

.delete-btn:hover {
    background: #d32f2f;
}

/* Ensure buttons are always visible on mobile devices */
@media (max-width: 768px) {
    .todo-actions {
        opacity: 1;
    }
}

.empty-state {
    text-align: center;
    padding: 60px 30px;
    color: #999;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #666;
}

.actions {
    padding: 20px 30px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.clear-btn {
    padding: 12px 25px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

.clear-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.edit-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-size: 1.1rem;
    background: white;
}

.edit-actions {
    display: flex;
    gap: 10px;
}

.save-btn,
.cancel-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.save-btn {
    background: #4CAF50;
    color: white;
}

.cancel-btn {
    background: #666;
    color: white;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        height: calc(100vh - 20px);
        border-radius: 15px;
    }
    
    header {
        padding: 20px 20px 15px 20px;
    }
    
    .header-text h1 {
        font-size: 1.5rem;
    }
    
    .filter-tabs {
        gap: 6px;
        margin-top: 8px;
    }
    
    .filter-buttons {
        gap: 6px;
    }
    
    .filter-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .settings-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .todo-input-container,
    .todo-stats,
    .actions {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .todo-item {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .button-group {
        width: 100%;
        gap: 10px;
    }
    
    #addBtn,
    .ai-btn {
        flex: 1;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
    }
}

/* Modal Styles */
.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(5px);
    animation: fadeIn 0.3s ease;
}

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

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.modal-header h2 i {
    margin-right: 10px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 30px;
}

@media (max-width: 480px) {
    .modal-content {
        width: 95%;
        max-width: none;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-header {
        padding: 20px;
    }
}

.setting-section {
    margin-bottom: 30px;
}

.setting-section:last-child {
    margin-bottom: 0;
}

.setting-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.setting-section h3 i {
    margin-right: 10px;
    color: #667eea;
}

.setting-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

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

.form-group label {
    display: block;
    color: #333;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group label i {
    margin-right: 8px;
    color: #667eea;
}

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

.token-input,
.model-select {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafafa;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.model-select {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-select option {
    white-space: normal;
    word-wrap: break-word;
    padding: 8px;
}

.token-input:focus,
.model-select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.model-select-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    overflow: hidden; /* Prevent overflow */
}

@media (max-width: 768px) {
    .model-select-wrapper {
        gap: 8px;
    }
    
    .model-select {
        font-size: 0.9rem;
        padding: 10px 12px;
    }
    
    .refresh-models-btn {
        padding: 10px 12px;
        min-width: 44px;
        flex-shrink: 0; /* Prevent button from shrinking */
    }
}

.refresh-models-btn {
    padding: 12px 15px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    flex-shrink: 0; /* Prevent button from shrinking */
    box-sizing: border-box; /* Include padding/border in width calculation */
}

.refresh-models-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
}

.refresh-models-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.refresh-models-btn.loading i {
    animation: spin 1s linear infinite;
}

.toggle-btn {
    padding: 12px 15px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.toggle-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    color: #667eea;
}

.input-help {
    display: block;
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

.input-help a {
    color: #667eea;
    text-decoration: none;
}

.input-help a:hover {
    text-decoration: underline;
}


.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.save-btn,
.cancel-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.cancel-btn {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e0e0e0;
}

.cancel-btn:hover {
    background: #e9ecef;
    border-color: #ccc;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid #667eea;
}

.notification.success .notification-content {
    border-left-color: #4CAF50;
}

.notification.error .notification-content {
    border-left-color: #f44336;
}

.notification.warning .notification-content {
    border-left-color: #ff9800;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    margin-left: 15px;
    padding: 0;
    line-height: 1;
}

.notification-close:hover {
    color: #666;
}

/* AI Button States */
.ai-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.ai-btn.loading {
    cursor: not-allowed;
    opacity: 0.8;
}

.ai-btn.loading:hover {
    transform: none;
    box-shadow: none;
}

.ai-btn.loading i {
    animation: spin 1s linear infinite;
}

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

/* AI Generated Todo Styling */
.todo-item.ai-generated {
    border-left: 3px solid #ff6b6b;
    background: linear-gradient(90deg, rgba(255, 107, 107, 0.05) 0%, transparent 100%);
}

.todo-item.ai-generated .todo-text::before {
    content: "🤖 ";
    font-size: 0.9em;
}