/* MIW Todo Frontend Styles */

/* Grundlegende Container-Styles */
.miw-todo-list {
    max-width: var(--wp--style--global--content-size);
    margin: 0 auto;
}

/* Tab-Navigation */
.todo-tabs {
    display: flex;
    border-bottom: 2px solid #e1e5e9;
    margin-bottom: 30px;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    /* font-size: 16px; */
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    color: #0073aa;
    background-color: #f8f9fa;
}

.tab-button.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #0073aa;
}

/* Tab-Inhalte */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Todo-Cards */
.todo-cards {
    margin-bottom: 30px;
}

.todo-card {
    display: grid;
    grid-template-areas: "header actions" "details actions";
    grid-template-columns: 1fr auto;
    border-bottom: 1px solid #e1e5e9;
    padding: .25em 0;
    transition: all 0.3s ease;
    position: relative;
}

@media (min-width: 768px) {
    .todo-cards .todo-card:hover {
        background-color: #eee;
    }
}

/* .todo-card.pending {
    border-left: 4px solid #0073aa;
}

.todo-card.overdue {
    border-left: 4px solid #dc3232;
}

.todo-card.completed {
    border-left: 4px solid #46b450;
    opacity: 0.8;
} */

/* Card-Header */
.card-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    grid-area: header;
}

.card-checkbox {
    flex-shrink: 0;
    line-height: 1;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: #0073aa;
}

.checkbox-completed {
    width: 20px;
    height: 20px;
    background: #46b450;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-completed + input {
    display: none;
}

.card-title {
    flex: 1;
}

.card-title h4 {
    margin: 0;
    padding: 0;
    color: #333;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;    
}

.card-description {
    margin: 0;
    color: #666;
    font-size: .9rem;
    line-height: 1.4;
    white-space: pre-line;
}

.card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    grid-area: actions;
    align-self: flex-start;
}

.edit-button,
.delete-button {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.comment-toggle {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
}

@media (min-width: 768px) {
    .comment-toggle:hover {
        background-color: #f1f1f1;
    }
}

.comment-chip {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    align-items: center;
    justify-content: center;
    background: #e7f3ff;
    color: #0073aa;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 600;
}

.edit-button {
    color: #0073aa;
}

.edit-button:hover {
    background-color: #e7f3ff;
}

.delete-button {
    color: #dc3232;
}

.delete-button:hover {
    background-color: #ffe7e7;
}

/* Card-Details */
.card-details {
    display: flex;
    flex-wrap: wrap;
    gap: .25em 1em;
    padding: 0 0 0 35px;
    grid-area: details;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75em;
    color: #666;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 0 4px;
    flex-basis: 15%;
    white-space: nowrap;
}

.detail-item.assigned {
    background-color: #005a87;
    color: #fff;
}

.detail-item.created-by {
    display: none;
    margin-left: auto;
}

.todo-card:hover .detail-item.created-by {
    display: flex;
}

.detail-icon {
    /* font-size: 16px; */
    width: 20px;
    text-align: center;
}

.overdue-warning {
    color: #dc3232;
    font-weight: 500;
}

/* Card-Footer */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.status-dropdown {
    flex: 1;
    margin-right: 15px;
}

.status-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    /* font-size: 14px; */
    background: white;
    cursor: pointer;
}

.status-select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.status-tag {
    padding: 6px 12px;
    border-radius: 20px;
    /* font-size: 12px; */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-tag.pending {
    background-color: #e7f3ff;
    color: #0073aa;
}

.status-tag.overdue {
    background-color: #ffe7e7;
    color: #dc3232;
}

.status-tag.completed {
    background-color: #e7f7e7;
    color: #46b450;
}

/* Kommentare */
.card-comments {
    margin: 6px 0 12px 35px;
    border-left: 2px solid #eee;
    padding-left: 12px;
    font-size: 1rem;
}

.comments-list {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.comment-item {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: .5em .75em;
}

.comment-item.created, 
.comment-item.completed {
    background-color: #fafffa;
    font-size: .8rem;
}

.comment-item.reopened, 
.comment-item.edited {
    background-color: #fafaff;
    font-size: .8rem;
}

.comment-item.created .comment-content, 
.comment-item.completed .comment-content, 
.comment-item.reopened .comment-content, 
.comment-item.edited .comment-content {
    font-style: italic;
}

.comment-meta {
    display: flex;
    gap: .5em;
    align-items: center;
    color: #666;
    font-size: .75em;
    margin-bottom: 6px;
}

.comment-meta .type {
    margin-left: auto;
    background: #f1f1f1;
    border-radius: 10px;
    padding: .1em .5em;
    font-size: .75em;
}

.comment-content {
    color: #333;
    white-space: pre-line;
}

.comment-form textarea {
    width: 100%;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: .5em;
    resize: vertical;
    box-sizing: border-box;
}

.comment-form .add-comment-button {
    margin-top: 6px;
    background: #0073aa;
    color: #fff;
    border: none;
    padding: .5em .75em;
    border-radius: 4px;
    cursor: pointer;
}

/* Keine Todos */
.no-todos {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-todos p {
    margin: 0;
    /* font-size: 16px; */
}

/* Formular-Styles */
.miw-todo-form {
    max-width: var(--wp--style--global--content-size);
    margin: 0 auto;
}

.miw-todo-form .todo-card {
    border: none;
}

.miw-todo-frontend-form input, .miw-todo-frontend-form select {
    border: none;
    background: transparent;
    font-size: 1em;
}

.miw-todo-frontend-form #todo_title {
    font-size: 1.2em;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
    width: 100%;
    border: none;
}

.miw-todo-frontend-form textarea {
    border: none;
    background: transparent;
    color: #666;
    /* font-size: 14px; */
    line-height: 1.4;
    font-family: inherit;
    width: 100%;
    resize: none;
}

.miw-todo-frontend-form h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 20px;
    font-weight: 600;
}

.miw-todo-frontend-form button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    /* font-size: 16px; */
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.miw-todo-frontend-form button {
    background: #005a87;
}

.miw-todo-frontend-form button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Edit-Notice */
.edit-notice {
    background: #e7f3ff;
    border: 1px solid #0073aa;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-notice p {
    margin: 0;
    color: #0073aa;
    font-weight: 500;
}

.cancel-edit {
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    padding: 6px 12px;
    border: 1px solid #0073aa;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.cancel-edit:hover {
    background: #0073aa;
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .todo-tabs {
        margin-bottom: 1em;
    }

    .todo-cards {
        grid-template-columns: 1fr;
        margin-bottom: 1em;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }

    .card-details {
        gap: .25em;
        font-size: .75em;
    }
    
    .card-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .status-dropdown {
        margin-right: 0;
    }
}

/* Animationen */
.todo-card {
    animation: fadeInUp 0.3s ease;
}

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

/* Hover-Effekte */
.todo-card:hover .card-actions {
    opacity: 1;
}

.card-actions {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

@media (min-width: 768px) {
.tab-pane .todo-card .card-actions .edit-button {
    visibility: hidden;
}
}

.tab-pane .todo-card:hover .card-actions .edit-button {
    visibility: visible;
}

/* Status-Übergänge */
.todo-card.completed {
    transition: all 0.5s ease;
}

.todo-card.completed .card-title h4 {
    color: #999;
}

/* Überfällig-Warnung */
.todo-card.overdue .card-title h4 {
    color: #dc3232;
}

.todo-card.overdue .detail-item.overdue-warning {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* pagination */
.pagination {
    text-align: center;
}

.pagination button {
    border: 1px solid #eee;
    background: transparent;
    border-radius: 5px;
    width: 42px;
    height: 42px;
    margin: 0 .5em;
    cursor: pointer;
}

.pagination button:hover {
    border-color: transparent;
    background: #005a87;
    color: #fff;
}

/* Auto-Complete Styles */
.autocomplete-container {
    position: relative;
    width: 100%;
    min-width: 20em;
    padding: 0;
}

.autocomplete-container #assigned_user_display {
    border: none;
}

.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.focused {
    background-color: #f8f9fa;
}

.autocomplete-container input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.autocomplete-container input[type="text"]:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.autocomplete-container input[type="text"].error {
    border-color: #dc3232;
    box-shadow: 0 0 0 2px rgba(220, 50, 50, 0.2);
    background-color: #ffeaea;
}

.autocomplete-container input[type="text"].error::placeholder {
    color: #dc3232;
    font-weight: 500;
}
