@{
    ViewData["Title"] = "Todo";
}
<!DOCTYPE html>
<html lang="sv" ng-app="todoApp">
<head>
    <meta charset="utf-8" />
    <title>@ViewData["Title"]</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.min.js"></script>
    <script src="~/js/todo.js" asp-append-version="true"></script>

    <style>
        .todo-column input[type="text"],
.todo-column textarea,
.todo-column select {
    width: 100%;
    margin-top: 6px;
    margin-bottom: 6px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.9em;
}

.todo-column textarea {
    resize: vertical;
    min-height: 60px;
}

.todo-column button {
    margin-top: 10px;
    width: 100%;
}

        .todo-board {
            font-family: sans-serif;
        }
        .todo-columns {
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
        }
        .todo-column {
            background: #f1f5f9;
            border-radius: 8px;
            padding: 10px;
            width: 250px;
            min-height: 200px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        .todo-column h2 {
            margin-top: 0;
        }
        .todo-task {
            background: white;
            padding: 8px;
            border-radius: 6px;
            margin-bottom: 6px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            cursor: move;
        }
        input[type="text"] {
            width: 100%;
            margin-top: 8px;
            padding: 6px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        button {
            margin-top: 6px;
            padding: 6px 10px;
            background-color: #3b82f6;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .priority-low {
            border-left: 4px solid #10b981;
        }
        .priority-medium {
            border-left: 4px solid #f59e0b;
        }
        .priority-high {
            border-left: 4px solid #ef4444;
        }
    </style>
</head>
<body ng-controller="TodoController" class="todo-board" ng-init="LoadTasks()">

    <h1>🗂️ Min idé-board</h1>

        <div class="todo-columns">
            <div class="todo-column"
                    ng-repeat="col in Columns"
                    droppable-column
                    ng-attr-column-id="{{col.Id}}"
                    on-drop="MoveTask(task, columnId)">            
            <h2>{{ col.Title }}</h2>

            <div class="todo-task {{ PriorityClass(task.Priority) }}"
                 ng-repeat="task in FilteredTasks(col.Id) track by task.Id"
                 draggable-task
                 task="task"
                 ng-if="!task.IsArchived">
     
                <strong>{{ task.Title }}</strong>

                <p ng-if="task.Description">{{ task.Description }}</p>

                <div>
                    <small>🏷️ {{ task.Tags }}</small><br />
                    <small>📅 {{ task.CreatedAt | date:'yyyy-MM-dd HH:mm' }}</small>
                </div>

                <div>
                    <small>Prioritet:
                        <select ng-model="task.Priority" ng-change="UpdatePriority(task)">
                            <option value="1">Låg</option>
                            <option value="2">Medel</option>
                            <option value="3">Hög</option>
                        </select>
                    </small>
                </div>
            </div>


            <div ng-if="col.Id === 'ideas'">
                <input type="text" ng-model="NewTask.Title" placeholder="Ny idé..." />
                <textarea ng-model="NewTask.Description" placeholder="Beskrivning"></textarea>
                <input type="text" ng-model="NewTask.Tags" placeholder="Taggar (komma-separerat)" />
                <select ng-model="NewTask.Priority">
                    <option value="1">Låg</option>
                    <option value="2">Medel</option>
                    <option value="3">Hög</option>
                </select>
                <button type="button" ng-click="AddTask()">Lägg till</button>
            </div>

        </div>
    </div>


</body>
</html>
