/* Styles for Hub and Lib Modals */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    /* `backdrop-filter: blur(...)` was removed deliberately: it caused
       persistent flicker of the translucent sidebar whenever the overlay
       repainted (every signal change behind it). The rgba background alone
       gives enough visual separation. */
}

/* Standalone dependencies modal: sit near the top of the screen and keep the
   backdrop light, so the user can still see the tasks/Gantt behind while
   editing. Defined here (after `.modal-overlay`) so it wins the cascade. */
.modal-overlay.deps-modal-overlay {
    align-items: flex-start;
    padding-top: 8vh;
    background: rgba(0, 0, 0, 0.28);
}

.hub-modal,
.lib-modal {
    max-width: 480px;
}

.modal-tabs {
    display: flex;
    gap: 4px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-docs);
    /* margin-top: -10px; */
    margin-bottom: 10px;
}

.modal-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

/* `.modal-content` later in this file caps width at 480px — bump
   specificity so the task modal can take its full 720px. */
.modal-content.task-modal-content {
    width: min(720px, 92vw);
    max-width: 720px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

.modal-content.task-modal-content.big{
    width:92vw;
    max-width:92vw;
    height:90dvh;
}

/* ============================================================
   Task modal — internal layout
   Two-column form using grid for predictable spacing.
   ============================================================ */
.task-modal-content .modal-body {
    /* padding: 18px 22px 6px; */
    overflow-y: auto;
    scroll-behavior: smooth;
}

.task-modal-content .form-group {
    margin: 0;
}

.task-modal-content .form-group + .form-group,
.task-modal-content .form-group + .form-row,
.task-modal-content .form-row + .form-group,
.task-modal-content .form-row + .form-row {
    margin-top: 18px;
}

.task-modal-content .form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary, #9ca3af);
    margin-bottom: 6px;
}

.task-modal-content .form-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid var(--border-docs);
    border-radius: 8px;
    background: var(--bg-secondary, #ffffff);
    color: var(--text-primary, #1f1f23);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 120ms, box-shadow 120ms;
}

.task-modal-content .form-input:focus {
    outline: none;
    border-color: var(--accent, #6366f1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* The main row holding the four shorter fields (start, due, priority, type)
   gets explicit grid columns so they always align. The two date columns get
   slightly more room because <input type="date"> always reserves space for
   the picker icon. */
.task-modal-content .task-modal-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(200px,1.4fr));
    align-items: center;
    gap: 14px;
}

/* Create-mode: collapse to a single centered column. */
.task-modal-content .task-modal-grid-4.create-mode {
    grid-template-columns: repeat(auto-fill,minmax(8rem,1.4fr));
    justify-content: center;
}

.task-modal-content .task-modal-grid-4.create-mode > .assignees{
    grid-column: 1 / -1;
    border-top: 1px solid var(--border-docs);
    padding-top:1rem;

}

.task-modal-content .task-modal-grid-4.create-mode > .tags{
    grid-column: 1 / -1;
    padding-top:1rem;
    border-top: 1px solid var(--border-docs);
}

.task-modal-content .task-modal-grid-4 .form-group {
    min-width: 0;
    /* Cancel the generic adjacent-sibling margin we apply between form
       groups elsewhere — inside the grid, columns share a single row. */
    margin-top: 0 !important;
}

.task-modal-content .task-modal-grid-4 .form-input {
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

/* Native date inputs in WebKit place the picker icon to the right. Give it
   a touch more horizontal padding so the dd/mm/aaaa text never collides
   with the icon. */
.task-modal-content input[type="date"].form-input {
    padding-right: 6px;
    font-variant-numeric: tabular-nums;
}

/* Section header used between groups (e.g. "Atribuições"). */
.task-modal-content .task-modal-section {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary, #9ca3af);
    margin: 22px 0 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border-docs);
}

/* Assignees and tags become scrollable horizontally if they overflow but
   wrap on big screens — keeps the modal height bounded. */
.task-modal-content .modal-assignees-list,
.task-modal-content .modal-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px 0;
}

@media (max-width: 640px) {
    .task-modal-content .task-modal-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.task-modal-comments {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    
}

.task-modal-comments .comment-modal-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    max-height: 400px;
}

.task-modal-comments .comment-modal-input {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-docs);
}

.task-modal-comments .comment-modal-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.hub-preview,
.lib-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-top: 16px;
}

.hub-preview-icon,
.lib-preview-icon {
    font-size: 1.25rem;
}

.hub-preview-name,
.lib-preview-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Delete lib modal */
.delete-lib-modal {
    max-width: 480px;
}

.warning-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.warning-text strong {
    color: var(--accent);
}

.action-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.danger-text {
    color: #f87171;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-primary);
    font-size: 0.9rem;
    margin-left: 26px;
    max-width: calc(100% - 26px);
}

/* Modal Specifics from app.css */
.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 480px;
    color: var(--text-primary);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-docs);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.task-modal-meatball-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 6px;
    line-height: 0;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.task-modal-meatball-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.task-modal-meatball-menu {
    display: flex;
    flex-direction: column;
    min-width: 160px;
    padding: 4px;
}

.task-modal-meatball-item {
    background: none;
    border: none;
    text-align: left;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-modal-meatball-item:hover {
    background: var(--bg-tertiary);
}

.task-modal-meatball-item.danger {
    color: #c0392b;
}

.task-modal-meatball-item.danger:hover {
    background: rgba(192, 57, 43, 0.1);
}

.modal-body {
    padding: 24px;
    height:100%;
    overflow: hidden;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.footer-right {
    display: flex;
    gap: 12px;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-docs);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}