/* Responsibilities Section Styles */

.responsibilities-section {
    margin-top: 40px;
}

.responsibilities-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.responsibilities-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text);
}

.responsibilities-setup {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.key-person-selector {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.key-person-selector label {
    display: block;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    font-size: 1rem;
}

.key-person-selector select {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.key-person-selector select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.responsibilities-tasks h4 {
    margin: 0 0 16px 0;
    font-size: 1rem;
    color: var(--text);
    font-weight: 600;
}

.task-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.task-item:hover,
.task-item:active {
    border-color: var(--accent);
    background: var(--hover-bg);
}

.task-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.task-item label {
    flex: 1;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
}

.task-item.default-task {
    opacity: 0.7;
    background: var(--hover);
}

.task-item.default-task input[type="checkbox"] {
    cursor: not-allowed;
}

.task-item.default-task label {
    cursor: default;
}

.task-item.custom-task {
    position: relative;
}

.remove-task-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    transition: color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.remove-task-btn:hover,
.remove-task-btn:active {
    color: #ef4444;
}

.add-task-form {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.add-task-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

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

/* Assignments Display */
.responsibilities-assignments {
    min-height: 100px;
}

.assignments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    animation: fade-in 0.4s ease;
}

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

.assignment-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    animation: card-in 0.4s ease both;
    -webkit-tap-highlight-color: transparent;
}

.assignment-card:nth-child(1) { animation-delay: 0ms; }
.assignment-card:nth-child(2) { animation-delay: 80ms; }
.assignment-card:nth-child(3) { animation-delay: 160ms; }
.assignment-card:nth-child(4) { animation-delay: 240ms; }
.assignment-card:nth-child(5) { animation-delay: 320ms; }

@keyframes card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (hover: hover) {
    .assignment-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
        border-color: var(--accent);
    }
}

.assignment-card.key-person {
    border-color: #10b981;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.key-person-badge {
    display: inline-block;
    background: #10b981;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.assignment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}

.assignment-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--accent);
    font-weight: 700;
}

.assignment-card.key-person .assignment-header h4 {
    color: #10b981;
}

.task-count {
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.assignment-tasks {
    list-style: none;
    padding: 0;
    margin: 0;
}

.assignment-tasks li {
    padding: 10px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.4;
}

.assignment-tasks li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.1rem;
}

.assignment-tasks li:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.phone-sequence {
    color: var(--muted);
    font-size: 0.85rem;
    font-style: italic;
    margin-left: 4px;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .responsibilities-section {
        margin-top: 30px;
        padding-top: 20px;
    }

    .responsibilities-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .responsibilities-header h3 {
        text-align: center;
        font-size: 1.3rem;
    }

    .responsibilities-setup {
        padding: 16px;
    }

    .key-person-selector {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .key-person-selector label {
        font-size: 0.95rem;
        margin-bottom: 10px;
    }

    .key-person-selector select {
        max-width: 100%;
        width: 100%;
        padding: 14px 16px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .task-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .task-item {
        padding: 12px 14px;
        font-size: 1rem;
        min-height: 48px; /* Touch-friendly target size */
    }

    .task-item input[type="checkbox"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        flex-shrink: 0;
    }

    .task-item label {
        font-size: 1rem;
        line-height: 1.4;
    }

    .remove-task-btn {
        font-size: 1.8rem;
        padding: 4px 8px;
        min-width: 32px;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .add-task-form {
        flex-direction: column;
        gap: 12px;
    }

    .add-task-form input {
        padding: 14px 16px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        width: 100%;
    }

    .add-task-form button {
        padding: 14px;
        font-size: 1rem;
    }

    #randomize-responsibilities {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
    }

    .assignments-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .assignment-card {
        padding: 16px;
    }

    .assignment-header h4 {
        font-size: 1.1rem;
    }

    .assignment-tasks li {
        padding: 12px 0;
        padding-left: 28px;
        font-size: 1rem;
    }
}

/* Extra small phones */
@media (max-width: 480px) {
    .responsibilities-header h3 {
        font-size: 1.2rem;
    }

    .responsibilities-setup {
        padding: 12px;
    }

    .task-item {
        padding: 10px 12px;
    }

    .assignment-card {
        padding: 14px;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .task-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .assignments-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Print styles */
@media print {
    .responsibilities-setup {
        display: none;
    }

    .responsibilities-header button {
        display: none;
    }

    .assignment-card {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
